Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Swift Package Manager support #1150 #1155

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ios/mobile_scanner.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ An universal scanner for Flutter based on MLKit.
s.license = { :file => '../LICENSE' }
s.author = { 'Julian Steenbakker' => 'juliansteenbakker@outlook.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.source_files = 'mobile_scanner/Sources/mobile_scanner/**/*.swift'
s.dependency 'Flutter'
s.dependency 'GoogleMLKit/BarcodeScanning', '~> 6.0.0'
s.platform = :ios, '12.0'
s.static_framework = true
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
s.resource_bundles = { 'mobile_scanner_privacy' => ['Resources/PrivacyInfo.xcprivacy'] }
end
s.resource_bundles = {'mobile_scanner_privacy' => ['mobile_scanner/Sources/mobile_scanner/PrivacyInfo.xcprivacy']}
end
29 changes: 29 additions & 0 deletions ios/mobile_scanner/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "mobile_scanner",
platforms: [
.iOS("12.0")
],
products: [
.library(name: "mobile-scanner", targets: ["mobile_scanner"])
],
dependencies: [],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to wait for MLKit to publish an SPM version of their package, before adding it here?

If your ios/plugin_name.podspec file has [CocoaPods dependency](https://guides.cocoapods.org/syntax/podspec.html#dependency)s, add the corresponding [Swift Package Manager dependencies](https://developer.apple.com/documentation/packagedescription/package/dependency) to your Package.swift file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like MLKit is only supported by Cocoapods, I do have a work around here https://github.com/kientux/google-mlkit-spm

But it looks like they are not planning to support SPM based off the interaction here (This is a very old conversation) : googlesamples/mlkit#627

Let me know if we should try the workaround

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm not sure if we should start using a third-party dependency to work around this.
I'll ask in the Flutter #package-authors chat with Loïc (who is working on SPM support in flutter/packages) maybe they can reach out to other Googlers for this (since MLKit is a Google product)

cc @juliansteenbakker for an additional opinion.

targets: [
.target(
name: "mobile_scanner",
dependencies: [],
resources: [
// For more information, see:
// https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
.process("PrivacyInfo.xcprivacy"),

// To add other resources, see the instructions at
// https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package
]
)
]
)
Loading