bioche
(Eric Blachère)
May 8, 2020, 4:25pm
1
Hello all,
I have a compilation error that I don't really understand. Perhaps you could enlighten me.
I managed to reduce my problem to this small capture
Does anyone know why the compiler complains about encode method being necessary in iOS 10 +, even if the extension in itself is only available post iOS 13 ?
FYI : iOS 10.0.0 is the target version of the library the piece of code belongs to.
Thank you in advance
jlukas
(Jacob Lukas)
May 8, 2020, 4:26pm
2
Swift does not support @available protocol conformance.
bioche
(Eric Blachère)
May 8, 2020, 4:33pm
3
Thank you for your answer. That explains it. It does seem to work with some protocol conformance however. This code works for instance :
struct A { }
@available(iOS 13, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
extension A: Identifiable {
var id: String {
"someId"
}
}
Is it because Identifiable is available starting with iOS 13 while Encodable is available on all versions ?