With Swift v4.2 they introduced the extension Bool.toggle()
, I had this extension since earlier and now when I compile with Xcode10 it says Ambiguous use of 'toggle()'
. I tried to make it ignore my own extension if Swift version is 4.2 or higher so I used the build configuration swift(>=)
which should check if the current swift version is equal or higher than the specified version.
public extension Bool {
#if swift(>=4.2)
// DO NOTHING
#else
mutating func toggle() {
self = !self
}
#endif
}
This should only see the comment DO NOTHING when on Xcode10 and on Xcode9 it should see the extended method. But whats happening is when on Xcode10 it still sees the method and I still get the error "Ambiguous use" and on Xcode9 it sees the method as well. I also changed the Build Setting Swift Language Version
to Swift 4.2
and still the compiler sees the method.