I'm attempting to slowly migrate an Objective C app over to Swift and have started to create new classes -
public class MapsAPI : NSObject {
let delegate: MapsAPIResponseDelegate
public init(managerWithDelegate delegate: MapsAPIResponseDelegate) {
self.delegate = delegate
}
}
Now in my Objective C .m
file I've declared #import MyTarget-Swift.h
and in my .h
I've added @class MapsAPI
which all seems fine however I'm not sure what the Objective C initialisation code should look like. I've tried -
MapsAPI *api = [[MapsAPI alloc] initWithManagerWithDelegate: self];
But that errors with -
No visible @interface for 'MapsAPI' declares the selector 'initWithManagerWithDelegate:'
I've tried looking at the definition of my MyTarget-Swift.h
but all that shows is -
SWIFT_CLASS("_TtC4What7MapsAPI")
@interface MapsAPI : NSObject
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end
Is there something I'm doing wrong here?