When you performed the migration Xcode asked about @objc
inference and you probably selected the new type instead of Swift3.
Possible solutions:
Use @objc
Use @objc
on each method, as needed instead of the whole class.
Use @objcMembers
You could just use @objcMembers
on the class.
Applying @objcMembers attribute to a class implicitly adds the @objc attribute to all of its Objective-C compatible members.
Writing Swift Classes and Protocols with Objective-C Behavior
Keep in mind: because applying the @objc attribute can increase the compiled size of an app and adversely affect performance, only apply the @objcMembers attribute on declarations when each member needs to have the @objc attribute applied.
Switch inference to the old behavior
You can also change the project’s behavior under:
Build Settings
> Swift 3 @objc Inference
> On
/Off
Related questions:
- The use of Swift 3 @objc inference in Swift 4 mode is deprecated?
- How can I deal with @objc inference deprecation with #selector() in Swift 4?