I want to point out something in addition to the notable answer - I don't know if this is a mistake or not.
If you somehow subclass NSObject (in my case, I have been subclassing UIView, which is an internal subclass of NSObject), you need to declare an overridden function with @objc , otherwise your test will not compile. In my case, the compiler itself crashes:
Segmentation Error: 11
So the following class:
public class ClassA: UIView { @objc public func johnAppleseed() { } }
Test the device as follows:
class ClassATests: XCTestCase { func testExample() { class ClassAChildren: ClassA { @objc private override func johnAppleseed() { } } } }
hris.to May 29 '15 at 13:00 2015-05-29 13:00
source share