I started the migration of a project with the recommended wizard on Xcode 9 over a project that has both Objc and Swift working together.
The problem occurs when having the following UIColor
extension:
extension UIColor {
func doSomething(withAnotherColor color: UIColor) -> Bool {
return true
}
}
then on some Objc class:
@implementation MyView
- (void)styleView {
//... some code
if ([someColor doSomethingWithAnotherColor:anotherColor]) {
...
}
}
@end
The if
statement is throwing the following error: ../MyView.m: No visible @interface for 'UIColor' declares the selector 'doSomethingWithAnotherColor:'
I tried using @objc
directive both on the extension and method without luck.
Note this is a compilation error, not a warning like mentioned on other questions, like this one: How can I deal with @objc inference deprecation with #selector() in Swift 4?
Any ideas?