I have a Swift class:
@objc
public class MZAActiveState: NSObject {
@objc static let privateSharedInstance = MZAActiveState()
..
@objc
public class func shared() -> MZAActiveState {
return privateSharedInstance
}
@objc var color: UIColor? = .red
}
In my Objective-C class I have included the Swift header (and the Singleton and its "shared" method is declared in this file):
#import "SketchWorkshop-Swift.h"
and I refer to the static shared instance in a method:
- (void) doSomething:(id)sender
{
[self.colorPickerController setInitialColor:[MZAActiveState shared].color];
}
I get no compiler warnings or build errors, but the color does not get set. If I place a breakpoint on the line and type:
(lldb) po [MZAActiveState shared].color;
I get this:
error: use of undeclared identifier ‘MZAActiveState'
I would expect to be able to see [MZAActiveState shared], since it is static and exposed (I believe) to Objective-C. What am I missing?
These links did not answer the question: