Skip to content

feat: add iOS Swift Package Manager support#20

Open
melihcelik-hubx wants to merge 1 commit into
flutter-fast-kit:masterfrom
melihcelik-hubx:feature/spm-migration
Open

feat: add iOS Swift Package Manager support#20
melihcelik-hubx wants to merge 1 commit into
flutter-fast-kit:masterfrom
melihcelik-hubx:feature/spm-migration

Conversation

@melihcelik-hubx

Copy link
Copy Markdown

Summary

Adds Swift Package Manager support for the iOS side of fk_user_agent while preserving CocoaPods compatibility for the plugin package.

This PR also updates the package to a Dart 3 / newer Flutter baseline, migrates the example iOS app to a SwiftPM-only setup, and adds focused unit coverage for the Dart-side caching behavior.

Changes

  • Added iOS Swift Package Manager support with Package.swift
  • Moved iOS plugin sources into the SwiftPM-compatible Sources/... layout
  • Updated the iOS podspec to reference the new source/header paths
  • Kept CocoaPods support for the published plugin package
  • Raised minimum support to:
    • Dart ^3.11.0
    • Flutter >=3.41.0
    • iOS 13.0
  • Updated example iOS project to use SwiftPM-only integration
  • Removed stale CocoaPods integration from the example app
  • Added .pubignore to keep publish artifacts cleaner
  • Added unit tests for FkUserAgent cache/init/release behavior
  • Fixed Dart 3 compatibility issues in the package/test code
  • Updated README and CHANGELOG for the breaking release

Why

Flutter now supports Swift Package Manager for iOS plugins, and plugin consumers are gradually moving away from CocoaPods. This change makes the plugin compatible with SwiftPM-based iOS integration without dropping CocoaPods support for users who still rely on it.

Breaking Changes

This PR should be released as a major version.

  • Minimum Dart version is now ^3.11.0
  • Minimum Flutter version is now >=3.41.0
  • Minimum iOS version is now 13.0

Validation

Dart / package

  • flutter test
  • flutter analyze

Example app

  • flutter pub get
  • flutter build ios --simulator --debug --no-codesign

CocoaPods compatibility

  • flutter config --no-enable-swift-package-manager
  • pod lib lint ios/fk_user_agent.podspec --configuration=Debug --skip-tests --use-modular-headers --use-libraries
  • pod lib lint ios/fk_user_agent.podspec --configuration=Debug --skip-tests --use-modular-headers

SwiftPM compatibility

  • flutter config --enable-swift-package-manager
  • flutter build ios --simulator --debug --no-codesign

Notes

  • The Dart API remains unchanged.
  • Objective-C iOS implementation was kept as-is; this PR only changes packaging/layout.
  • The example app was fully cleaned up to remove lingering CocoaPods integration warnings once SwiftPM support was in place.

…retrieval

- Updated podspec version to 3.0.0 and improved summary and description.
- Added Package.swift for Swift Package Manager support.
- Implemented FkUserAgentPlugin in Objective-C to retrieve device user agents.
- Enhanced user agent retrieval logic to include WebView user agents.
- Updated Dart API to support async property fetching and improved initialization logic.
- Updated pubspec.yaml and pubspec.lock for Dart SDK and Flutter version compatibility.
- Added comprehensive tests for user agent properties and initialization behavior.
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