I'm probably missing something very obvious, but I have (very very simplified from the original code; it's open source, so I can point you the original if it helps):
SBOperation.h
@interface SBOperation : NSOperation {
// other fields/props/methods removed
}
- (id)initWithManagedObjectContext:(NSManagedObjectContext*)mainContext;
@end
SBSubsonicParsingOperation.h
// forward declared
@class SBClientController;
// forward declared, this is an NSManagedObjectID on a Swift Core Data object
@class SBServerID;
typedef NS_ENUM(NSInteger, SBSubsonicRequestType) {
// ...
}
@interface SBSubsonicParsingOperation : SBOperation <NSXMLParserDelegate> {
// ...
}
- (id)initWithManagedObjectContext:(NSManagedObjectContext*)mainContext
client:(SBClientController *)client
requestType:(SBSubsonicRequestType)type
server:(SBServerID *)objectID
xml:(NSData *)xml
mimeType:(NSString *)mimeType;
@end
That file is imported in my Swift bridging header.
However, if I try to initialize a class instance, I only get the initializer for its superclass that just takes an NSManagedObjectContext
:
// ERROR: Extra arguments at positions #2, #3, #4, #5, #6 in call
if let operation = SBSubsonicParsingOperation(managedObjectContext: self.managedObjectContext,
client: server.clientController,
requestType: type,
server: server.id,
xml: data,
mimeType: response.mimeType) {
If I go into Xcode and hit "generated Swift 5 header" for the parsing operation class:
// ...
open class SBSubsonicParsingOperation : SBOperation, XMLParserDelegate {
// ...
public init!(managedObjectContext mainContext: NSManagedObjectContext!, client: SBClientController!, requestType type: SBSubsonicRequestType, server objectID: SBServerID!, xml: Data!, mimeType: String!)
}
However, that initializer isn't visible to Swift in any other classes.
I'm using Xcode 14.3.1.