-
Notifications
You must be signed in to change notification settings - Fork 26
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(iOS 16, *) to generated class #67
Comments
Can you show the protocol you encountered this with? |
I can't show you the whole protocol for privacy reasons but I think it comes from the following properties: var foo: any SomeProtocol<SomeStruct> { get }
var bar: any SomeProtocol<AnotherStruct> { get }
var baz: any AnotherProtocol<SomeStruct> { get } I guess the runtime support for |
Adding the You are using primary associated type protocols in your iOS 15 project which cannot be used when casting. Casting type erased mock values is a core part of the library so as I see it this Swift feature is not compatible with mockable in your case on iOS 15. |
The compiler asks me to add the What's missing from iOS 15 is runtime support, which doesn't have anything to do with the SDK used to compile the app. iOS 15 has partial runtime support for primary associated types and inside the app, we do not (because we can't) use patterns that require iOS 16 runtime support. But the rest of the app works fine, we just can't use primary associated types in function parameters (I believe), which is what the mock does. The right thing to do would be to have the macro detect protocols with primary associated types and add the annotation on the class if there are any, since the generated code requires the iOS 16 runtime in that case. |
I see, you are right... Will try to write the code for detecting this edge case. Will request a review from you when its ready. |
@nathansalaun-sofia Pls check out my PR if you can at: #68 |
@nathansalaun-sofia The fix is available in 0.0.10 |
When using
@Mockable
on my project I have the following error:Runtime support for parameterized protocol types is only available in iOS 16.0.0 or newer
. My app targets iOS 15.It's not a problem in test targets because I only run tests on the latest iOS version. However in order to compile, the mock needs
@available(iOS 16, *)
.The text was updated successfully, but these errors were encountered: