Repository navigation
feat: add Swift Package Manager support for iOS and fix iOS available-memory reporting - #113
Merged
Merged
Conversation
Migrate the iOS native source into an SPM package layout per the Flutter plugin guide. - Added ios/zero_inspector_kit/Package.swift: package name zero_inspector_kit, library zero-inspector-kit, platform iOS 13.0, FlutterFramework dependency, PrivacyInfo.xcprivacy as a resource. - Moved ZeroInspectorKitPlugin.swift and PrivacyInfo.xcprivacy into ios/zero_inspector_kit/Sources/zero_inspector_kit/. - Updated the podspec source_files path and enabled the privacy manifest resource bundle; CocoaPods support is retained as required.
Records the Swift Package Manager support and the iOS source layout move under a version placeholder, since this change will ship together with the next release and its version is not decided yet.
availMem was estimated as device total physical memory minus this process RSS, which ignored other processes and badly over-reported available memory. It now uses os_proc_available_memory() on iOS 13 plus. Also removes the now-unused getUsedMemory() helper, fills threshold with 0 because iOS has no equivalent of Android MemoryInfo.threshold, and clarifies the Dart field docs about the per-platform semantics.
Version bump covering the Swift Package Manager support and the iOS available-memory fix. Also adds a version field to the example app so iOS builds no longer warn about a missing build name and number.
Adds .github/workflows/docs.yml, which on pushes to main touching website sources or pubspec.yaml builds the Nextra site and commits the result back to docs/ as github-actions bot. Pages keeps serving the docs folder of main, so no repository setting change is needed. sync-docs.mjs gains a --ci flag, because CI checks out a clean tree and the existing staged or unstaged change detection would always skip the build. The local .git/hooks/pre-commit is no longer used, and AGENTS.md plus CONTRIBUTING.md are updated to match (including the Pages branch, which is main and not docs/github-pages).
main is branch-protected, so a bot cannot push the built site back to it. docs.yml now publishes website/out/ to the root of the gh-pages branch (force_orphan, so the branch holds a single commit with only the built site), and the generated docs/ directory is removed from main. sync-docs.mjs now only builds into website/out/ and writes .nojekyll, instead of syncing into docs/. link-check.yml scans website/pages instead of the removed docs directory. AGENTS.md, CONTRIBUTING.md and .pubignore are updated to match. Manual step required once: Settings, Pages, Source, Deploy from a branch, branch gh-pages, folder root.
Scanning website/pages produced 69 false positives: Nextra uses extensionless route links such as /Custom-Database-Provider, which lychee resolves as local files that do not exist because the real file is Custom-Database-Provider.md. The previously scanned docs/ was built HTML where those routes existed as directories, so this only surfaced after the switch to the markdown source. link-check now scans only README.md, README_zh.md and CHANGELOG.md again, and both the workflow and AGENTS.md record why website/pages is excluded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 摘要
Adds Swift Package Manager (SPM) support for iOS while keeping CocoaPods, fixes the iOS
availMemmetric that was badly over-reported, and bumps the version to 1.15.0.为 iOS 新增 Swift Package Manager(SPM)支持(同时保留 CocoaPods),修复 iOS
availMem严重高估的问题,并将版本升至 1.15.0。Changes / 变更
ios/zero_inspector_kit/Package.swiftand moved the native Swift sources into the SPM layoutios/zero_inspector_kit/Sources/zero_inspector_kit/; the podspec now points at the new paths. CocoaPods support is kept, as Flutter requires plugins to support both until further notice.ios/zero_inspector_kit/Package.swift,并把原生 Swift 源码迁到 SPM 布局ios/zero_inspector_kit/Sources/zero_inspector_kit/;podspec 同步指向新路径。仍保留 CocoaPods 支持,因为 Flutter 要求插件暂时同时支持两者。availMem: it was estimated as "device total physical memory minus this process RSS", which ignored other processes and badly over-reported available memory. It now usesos_proc_available_memory()(iOS 13+). Removed the now-unusedgetUsedMemory()helper, and documented that iOS has no equivalent of Android'sMemoryInfo.threshold(filled with 0).availMem:此前按「设备总物理内存减去本进程 RSS」估算,忽略其它进程,严重高估可用内存;现改用os_proc_available_memory()(iOS 13+)。移除不再使用的getUsedMemory(),并注明 iOS 无 AndroidMemoryInfo.threshold对应项(填 0)。version: 1.0.0+1to the example app, removing the "Missing build name / build number" warnings on iOS builds.version: 1.0.0+1,消除 iOS 构建的 “Missing build name / build number” 警告。pubspec.yaml, the iOS podspec,inspector_version.dart, both READMEs (install snippet,release/v1.15.0ref, upgrade callout) andCHANGELOG.md.pubspec.yaml、iOS podspec、inspector_version.dart、中英 README(安装片段、release/v1.15.0引用、推荐升级文案)与CHANGELOG.md。Context / 背景
Flutter 3.44+ uses Swift Package Manager by default and the CocoaPods registry becomes read-only on December 2, 2026, so plugins without SPM support break projects that have migrated. While reviewing the iOS native memory collection (after the 1.14.1
lowMemoryfix),availMemturned out to have the same class of semantic defect, so it is fixed here as well.Flutter 3.44+ 默认启用 SwiftPM,且 CocoaPods registry 将于 2026 年 12 月 2 日转为只读,插件若不提供 SPM 支持会导致已迁移的项目出问题。在复查 iOS 原生内存采集(继 1.14.1 的
lowMemory修复之后)时发现availMem存在同类语义缺陷,故一并修复。Checklist / 检查项
Test plan
flutter analyzeclean andflutter testgreen (285 tests, includingversion_consistency_test) /flutter analyze无问题、flutter test全绿(285 项,含版本一致性测试)flutter config --enable-swift-package-manager, thencd example && flutter build ios --simulator --no-codesign/ 开启 SPM 后构建 iOS 示例flutter config --no-enable-swift-package-manager, rebuild, and runpod lib lint ios/zero_inspector_kit.podspec --configuration=Debug --skip-tests --use-modular-headers/ 关闭 SPM 后重新构建并跑 pod lib lint🤖 Generated with Zero Buddy