Repository navigation
feat: migrate iOS/macOS to Swift Package Manager - #158
Conversation
Adopt the SPM layout used by flutter_image_compress: - Move iOS sources to ios/image_editor_common/Sources/image_editor_common/ (.m flat, .h under include/image_editor_common/) - Move macOS sources to macos/image_editor_common/Sources/image_editor_common/ - Add Package.swift (iOS .iOS 9.0, macOS .macOS 10.15) with cSettings headerSearchPath, matching the podspec public_header layout - Update both podspecs to reference the new Sources paths - Add .build/ and Flutter/ephemeral/ to .gitignore - Migrate example iOS project for Flutter SPM integration The Package.swift product name 'image-editor-common' is auto-discovered by Flutter's SPM tooling; no pubspec swiftPackageManager key needed.
- Finish migrating the example app to Swift Package Manager on iOS and macOS - Wire FlutterGeneratedPluginSwiftPackage into the macOS Runner project - Deintegrate CocoaPods: remove Podfiles, Pod build phases, and Pods xcworkspace refs - Strip Pods-Runner.*.xcconfig includes from iOS/macOS Debug and Release xcconfigs - Fix missing AppKit import in image_editor_common's macOS FIImport.h - Refresh pubspec.lock and macOS AppDelegate.swift/scheme from flutter clean rebuild
feat: migrate example app to Swift Package Manager
CaiJingLong
left a comment
There was a problem hiding this comment.
Approved at 3ae6107 after #160 was merged into this branch. I reviewed the combined changes against main; no blocking library/API regression found.
The library retains Flutter >=2.10.0 / Dart >=2.12.0 and the existing CocoaPods deployment targets. Native source files are relocated without implementation changes apart from the necessary macOS AppKit import. CocoaPods source/header patterns match the new layout, and SwiftPM is an additional integration path. The newer example SDK/dependencies do not impose their lockfile requirement on consumers of the library.
Validation:
- Confirmed this head's tracked tree is identical to
8a86cce, already built during #160 review: Flutter 3.44.0 strict example lockfile resolution and unsigned iOS/macOS Debug SwiftPM builds passed. Those builds used command-line iOS 15.0 / macOS 12.0 deployment-target overrides for Xcode 27. - Added a temporary independent Flutter 3.24.3 host with SwiftPM disabled and explicit local overrides for the repository packages. CocoaPods installed the relocated local image_editor_common sources and the macOS Debug build passed (macOS 12.0 override for Xcode 27). This tests the local native implementation, not a published copy from pub.dev.
- Library dependency resolution/static analysis on Flutter 3.24.3, both podspec quick validations, the two platform-interface tests on Flutter 3.41.6, project/plist syntax, and
git diff --checkpassed in this review session. - Inspected the latest failed Runnable CI log: the failure is the eight example API deprecations addressed by #159, not the native migration.
Limitations: GitHub CI is not wholly green, and some compatibility jobs have failed; this approval is not a claim that those jobs pass. Flutter 2.10, an old-SDK iOS CocoaPods build, and device runtime behavior were not fully tested. Keep the library minimum low and retain older-SDK coverage when fixing CI; do not solve example/toolchain failures by raising the library minimum.
Summary
Migrate
image_editor_commoniOS and macOS native code to Swift Package Manager, following the same SPM layout asflutter_image_compress.Changes
Source restructuring (iOS + macOS)
Classes/→<platform>/image_editor_common/Sources/image_editor_common/*.m(flat)Sources/image_editor_common/include/image_editor_common/*.hgit mv(R100) — full history retainedSwift Package Manager
Package.swiftfor iOS (.iOS("9.0")) and macOS (.macOS("10.15"))image-editor-common, targetimage_editor_commoncSettings: [.headerSearchPath("include/image_editor_common")]for local header resolutionswiftPackageManagerkey — Flutter auto-discoversPackage.swiftPodspec compatibility
Sources/pathsExample & tooling
.gitignore: added**/.build/andFlutter/ephemeral/Verification
Backward compatibility
Both CocoaPods and SPM paths work against the same source tree. The CI matrix here exercises the CocoaPods path; SPM can be verified locally with
flutter config --enable-swift-package-manager.