Skip to content

Add Swift Package Manager support for iOS (1.5.0) - #93

Open
m3n99 wants to merge 1 commit into
fluttercommunity:masterfrom
m3n99:swift-package-manager
Open

m3n99 wants to merge 1 commit into
fluttercommunity:masterfrom
m3n99:swift-package-manager

Conversation

@m3n99

@m3n99 m3n99 commented Nov 12, 2026

Copy link
Copy Markdown

Summary

Adds Swift Package Manager support to the iOS implementation. CocoaPods keeps working. The Dart API, method channel names,
platform-view id and map logic are unchanged.

Changes

  • SwiftPM layout: sources moved (git mv, history kept) from ios/Classes to
    ios/apple_maps_flutter/Sources/apple_maps_flutter, plus a new ios/apple_maps_flutter/Package.swift (iOS 13.0, depends on
    FlutterFramework).
  • No mixed-language target: the Objective-C AppleMapsFlutterPlugin.h/.m shim is removed and SwiftAppleMapsFlutterPlugin is
    renamed to AppleMapsFlutterPlugin, so pluginClass and the generated registrant are unchanged.
  • Imports: explicit import Flutter / import UIKit in the files that relied on the CocoaPods umbrella header.
  • Podspec: new source_files path, public_header_files removed, iOS 13.0, Swift 5.9, and fixed metadata (summary, license
    type, source).
  • pubspec: sdk: ">=3.0.0 <4.0.0", flutter: ">=3.41.0" (needed for FlutterFramework), version 1.5.0.
  • Deprecations: the plugin imports flutter/widgets.dart instead of the deprecated material.dart; its only Material use was
    5 Colors.black/transparent defaults, now identical const Color(...) values, so there's no new dependency. Color.value is
    now toARGB32(). The example uses material_ui.
  • Analyzer fixes: == operators take Object, unnecessary imports removed, test mocks use
    TestDefaultBinaryMessengerBinding.
  • Example app: iOS target raised (Flutter 3.50 sets it to 15.0); Flutter's automatic project migrations committed (SwiftPM,
    UIScene, @main); Flutter/ephemeral/ ignored; driver tests wait for native layout before reading map state; a wrong assertion in
    testMyLocationButton initial value true is fixed.

Testing

On Flutter 3.50.0, Xcode 27.2, iOS simulator:

  • flutter analyze: no issues
  • flutter test: 42 passed
  • Example build with SwiftPM: passes, and the plugin is linked through FlutterGeneratedPluginSwiftPackage
  • Example build with CocoaPods (enable-swift-package-manager: false): passes
  • Driver tests on the simulator: 9/9 pass
  • Example app launched and the map pages render

Notes

  • pod lib lint builds without warnings but can't pass on Xcode 27.2: Xcode only builds iOS 15.0+, and the Flutter pod lint
    pulls from CocoaPods trunk declares iOS 11.0.
  • Flutter 3.50 limitation: once the example is migrated to SwiftPM, building it with SwiftPM turned off fails to resolve
    FlutterFramework. Test CocoaPods on an unmigrated example. Apps that use the plugin are not affected.
  • Breaking for consumers: requires Flutter 3.41+ and iOS 13.0+.

- Move iOS sources to ios/apple_maps_flutter/Sources/apple_maps_flutter
  and add Package.swift (iOS 13, FlutterFramework dependency).
- Remove the Objective-C registration shim; the plugin class is now the
  Swift class AppleMapsFlutterPlugin (pluginClass unchanged).
- Add explicit Flutter/UIKit imports that the CocoaPods umbrella header
  used to provide.
- Podspec: new source path, iOS 13.0, Swift 5.9, and metadata that
  passes pod lib lint without warnings.
- Require Flutter 3.5+ (Dart 3); bump version to 1.5.0.
- Replace deprecated package:flutter/material.dart: the plugin now only
  imports widgets.dart (no new dependency); the example uses material_ui.
- Fix analyzer warnings and deprecations (Color.value, mock handlers).
- Example: fix driver-test timing race and a wrong assertion; ignore
  Flutter/ephemeral; keep Flutter 3.50's project migrations.
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