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

Add @available(watchOSApplicationExtension 6.0, *) to all Inject classes to allow using it in a library that targets WatchOS as well #22

Closed
tkafka opened this issue Apr 13, 2022 · 2 comments

Comments

@tkafka
Copy link

tkafka commented Apr 13, 2022

(Obligatory intro - Inject is awesome, thank you!)

Hello, I develop an app that shares view code amon iOS and WatchOS extension targetys in a library. The library has set WatchOS 7.0 as a minimum target (see below), but adding Inject a dependency produces a lot of errors with SwiftUI APIs not available before WatchOS 6.

Could you please mark the classes (or a whole package - I don't know if it's possible) as WatcOS 6.0+ only?

Something like @available(watchOSApplicationExtension 6.0, *) should help.

Or is there a better way? I am confused as for why does Xcode try to build the package for all WatchOS versions if it's only going to be used in a library that targets 7.0+?

Thank you! Tomas

Screenshot 2022-04-13 at 11 26 58

Error Group
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Inject.swift:18:42: 'Animation' is only available in watchOS 6.0 or newer
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Inject.swift:45:30: 'AnyCancellable' is only available in watchOS 6.0 or newer
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Inject.swift:43:33: 'ObservableObject' is only available in watchOS 6.0 or newer
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/Hosts.swift:3:45: cannot find type 'UIViewController' in scope
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/Hosts.swift:4:35: cannot find type 'UIView' in scope
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/Hosts.swift:41:24: method does not override any method from its superclass
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/KitFrameworks.swift:5:11: cannot find type 'UIView' in scope
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/KitFrameworks.swift:6:11: cannot find type 'UIViewController' in scope
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/SwiftUI.swift:6:44: 'View' is only available in watchOS 6.0 or newer
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/SwiftUI.swift:14:74: 'View' is only available in watchOS 6.0 or newer
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/SwiftUI.swift:5:26: 'View' is only available in watchOS 6.0 or newer
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/SwiftUI.swift:6:31: 'some' return types are only available in watchOS 6.0.0 or newer
<redacted path>/SourcePackages/checkouts/Inject/Sources/Inject/Integrations/SwiftUI.swift:14:61: 'some' return types are only available in watchOS 6.0.0 or newer
@tkafka
Copy link
Author

tkafka commented Apr 13, 2022

Or, maybe just add .watchOS(.v6)into supported platforms? I'll try this.

@tkafka
Copy link
Author

tkafka commented Apr 13, 2022

This seems it might work, but I have been unable to get the shared library to work with Inject because of other problems. Would you try adding it? I created a PR: #23

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

No branches or pull requests

2 participants