Skip to content

Add Swift Package Manager support for iOS#35

Open
maclt wants to merge 1 commit intorefiner-io:mainfrom
maclt:feature/swift-package-manager-support
Open

Add Swift Package Manager support for iOS#35
maclt wants to merge 1 commit intorefiner-io:mainfrom
maclt:feature/swift-package-manager-support

Conversation

@maclt
Copy link
Copy Markdown

@maclt maclt commented May 8, 2026

What it does

Adds Swift Package Manager (SPM) support for the iOS plugin while keeping CocoaPods compatibility. Apps on Flutter 3.24+ with SPM enabled can now consume refiner_flutter without pod install. Apps on the legacy CocoaPods path keep working unchanged. Mirrors Flutter's first-party plugin layout (e.g. url_launcher_ios).

Changes

  • New ios/refiner_flutter/Package.swift — declares the refiner_flutter SPM package, depends on https://github.com/refiner-io/mobile-sdk-ios.git (from: 1.7.1), product refiner-flutter static library, iOS 12.0
  • Moved ios/Classes/RefinerFlutterPlugin.swiftios/refiner_flutter/Sources/refiner_flutter/RefinerFlutterPlugin.swift (Flutter SPM convention; same file builds under both systems)
  • Updated ios/refiner_flutter.podspecs.source_files repointed to the new path; everything else unchanged
  • Bumped pubspec.yaml to 1.9.0, Dart >=3.5.0, Flutter >=3.24.0
  • Bumped example/pubspec.yaml Dart floor to >=3.5.0
  • Documented CHANGELOG.md 1.9.0 entry; README.md iOS install section now covers both SPM and CocoaPods
  • gitignore .build/ and .swiftpm/ added to ios/.gitignore

The Swift source itself was not edited.

How to test it

  1. cd example
  2. CocoaPods path:
    • flutter config --no-enable-swift-package-manager
    • rm -rf ios/Pods ios/Podfile.lock && flutter clean && flutter pub get
    • flutter build ios --simulator --no-codesign — should build green
  3. SPM path:
    • flutter config --enable-swift-package-manager
    • flutter clean && flutter pub get
    • flutter build ios --simulator --no-codesign — should build green; expect Adding Swift Package Manager integration... step
  4. Launch the example app on a simulator under each path, exercise Refiner.initialize, Refiner.identifyUser, Refiner.trackEvent, and confirm a survey campaign fires
  5. pod lib lint ios/refiner_flutter.podspec --quick --allow-warnings — should pass

Verified locally on Flutter 3.35.6 + Xcode 26: both build paths green, pod lib lint passes with the same pre-existing warnings (no new ones).

Link to ticket

#34

Adds a Package.swift next to the existing podspec so the plugin can be
consumed via SPM (Flutter 3.24+) while keeping CocoaPods compatibility.
Mirrors the layout used by Flutter's first-party plugins
(e.g. url_launcher_ios).

- Move ios/Classes/RefinerFlutterPlugin.swift to
  ios/refiner_flutter/Sources/refiner_flutter/ (Flutter SPM convention)
- Add ios/refiner_flutter/Package.swift depending on
  https://github.com/refiner-io/mobile-sdk-ios.git (from: 1.7.1) as a
  static library product, iOS 12.0
- Repoint s.source_files in the podspec; deps, static_framework, and
  swift_version unchanged
- Bump pubspec to 1.9.0; raise floors to Dart >=3.5.0 and Flutter >=3.24.0
- Document both install paths in README; add 1.9.0 entry to CHANGELOG
- Ignore .build/ and .swiftpm/ in ios/.gitignore

Refs: refiner-io#34
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