-
Notifications
You must be signed in to change notification settings - Fork 153
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
Importing Pow conditionally on iOS 14 #25
Comments
It seems that the platform here platforms: [ .iOS(.v14) ] is a different type ( .product(name: "Pow", package: "Pow", condition: .when(platforms: [.iOS(.v15), .macCatalyst])) The latter doesn't seem to take a version parameter. However, |
Whoops1. From skimming through the forum, it seems like this is a problem in SPM that has been flagged before (although with slightly different usecases), so I'm not sure there's a solution here 😔. Let me know if you'd like a refund. Footnotes
|
Thanks for looking into this, Robb! I thought this might be a limitation of SPM because I couldn't really find a solution, so definitely not an issue with Pow! I’ll still have use-cases for this though, and happy to support this project! What I dont really understand is why I can include Pow in an Xcode App project targeting iOS 14, and then conditionally use the framework (but not do the same in a Swift Package @apple 👀): import Pow
extension View {
func conditionalShineRepetitionEffectiOS16() -> some View {
if #available(iOS 16.0, *) {
return self.conditionalEffect(.repeat(.shine, every: .seconds(2)), condition: true)
} else {
return self
}
}
} (also, I dont really like this workaround, it complicates the code (but it works!). Would be great to have an |
Thanks, I appreciate it!
I think that's because SPM resolves the dependencies just once when you pull them whereas in an App project, you just call methods at runtime (which the I definitely agree on the workaround being a pain, (see also to #22), conditionally invoking view modifiers based on availability is a pain with SwiftUIs chaining syntax. |
Hmm, AVFAudio was introduced in 14.5 and since Pow's deployment target is 15, it's not weak-linked? Are you using |
I would like to use Pow in a Swift Package supporting iOS 14:
I’ve tried to include the package using the
condition
parameter:But somehow that doesn't work, Xcode is complaining like so:
Of course I’ll have to put these
if #available(iOS 15.0, *)
flags every time I use Pow code.Any idea how to achieve this?
The text was updated successfully, but these errors were encountered: