Author Topic: Why am I getting the "IBOutlet property cannot have non-@objc class type" error?  (Read 5455 times)

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
You typically get the Swift Compiler error "IBOutlet property cannot have non-@objc class type" error when your IBOutlet references a Swift class that is not a descendant of NSObject.

There are two main ways to solve this problem:

1. Change your class to be a descendant of NSObject.
2. Mark your class with @objc attribute. For example:

Code: [Select]
@objc class Calculator {
}

All the best!
Kevin McNeish
Author of Learn to Code in Swift: https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11