Skip to content

feat: migrate iOS/macOS to Swift Package Manager - #158

Open
AlexV525 wants to merge 1 commit into
mainfrom
feat/spm-support
Open

feat: migrate iOS/macOS to Swift Package Manager#158
AlexV525 wants to merge 1 commit into
mainfrom
feat/spm-support

Conversation

@AlexV525

Copy link
Copy Markdown
Member

Summary

Migrate image_editor_common iOS and macOS native code to Swift Package Manager, following the same SPM layout as flutter_image_compress.

Changes

Source restructuring (iOS + macOS)

  • Classes/<platform>/image_editor_common/Sources/image_editor_common/*.m (flat)
  • Headers → Sources/image_editor_common/include/image_editor_common/*.h
  • Preserved as git mv (R100) — full history retained

Swift Package Manager

  • Added Package.swift for iOS (.iOS("9.0")) and macOS (.macOS("10.15"))
  • Product name image-editor-common, target image_editor_common
  • cSettings: [.headerSearchPath("include/image_editor_common")] for local header resolution
  • No pubspec swiftPackageManager key — Flutter auto-discovers Package.swift

Podspec compatibility

  • Both podspecs updated to reference the new Sources/ paths
  • CocoaPods builds remain fully functional (backward compatible)

Example & tooling

  • Example iOS project migrated for Flutter SPM integration
  • .gitignore: added **/.build/ and Flutter/ephemeral/

Verification

flutter build ios --debug --no-codesign
→ ✓ Built build/ios/iphoneos/Runner.app
→ Adding Swift Package Manager integration... (3.8s)
→ FlutterGeneratedPluginSwiftPackage resolves image_editor_common via SPM
→ image_editor_common NOT in Podfile.lock (confirmed via SPM)

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant