Skip to content

Add Swift Package Manager support for permission_handler_apple#1525

Open
danyabdo94 wants to merge 1 commit intoBaseflow:mainfrom
danyabdo94:feature/add-spm-support
Open

Add Swift Package Manager support for permission_handler_apple#1525
danyabdo94 wants to merge 1 commit intoBaseflow:mainfrom
danyabdo94:feature/add-spm-support

Conversation

@danyabdo94
Copy link
Copy Markdown

Summary

  • Add Package.swift and SPM-compatible source layout in permission_handler_apple/ios/permission_handler_apple/
  • Existing CocoaPods structure in ios/Classes/ is preserved for backward compatibility
  • Permission preprocessor macros are defined via cSettings with all permissions enabled by default, matching CocoaPods behavior
  • Includes PrivacyInfo.xcprivacy as a bundled resource

Context

Flutter now supports Swift Package Manager as a native dependency resolution mechanism. Plugins that provide a Package.swift in their ios/<plugin_name>/ directory are automatically resolved via SPM.

Without SPM support, Flutter falls back to CocoaPods for the entire project when even a single plugin lacks a Package.swift.

Permission macros

With CocoaPods, permission macros (e.g., PERMISSION_CAMERA=1) are typically set via GCC_PREPROCESSOR_DEFINITIONS in the Podfile. With SPM, these are configured via cSettings .define() entries in Package.swift.

All permissions are enabled by default to match the behavior users get with CocoaPods when no explicit macro configuration is provided. Apps that need to disable specific permissions can customize by overriding the package or adjusting the cSettings defines.

Related: #1440

Test plan

  • flutter build ios succeeds with SPM enabled (flutter config --enable-swift-package-manager)
  • Zero CocoaPods fallback warnings in build output
  • Permission requests (camera, photos, microphone, notifications) work correctly at runtime
  • flutter build ios --release produces a valid IPA

🤖 Generated with Claude Code

Adds Package.swift and SPM-compatible source layout alongside existing
CocoaPods structure. Permission macros are defined via cSettings with
all permissions enabled by default, matching CocoaPods behavior.

Apps that need to disable specific permissions can customize by
overriding the package or adjusting the cSettings defines.
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