我正在努力从swift访问Obj-C类方法,我不明白为什么/发生了什么....
Obj-C头文件
// Visible in swift
+ (Player *)methodInManagedObjectContext:(NSManagedObjectContext *)moc
withGivenName:(NSString *)givenName
familyName:(NSString *)familyName;
// NOT Visible in swift
+ (Player *)newPlayerInManagedObjectContext:(NSManagedObjectContext *)moc
withGivenName:(NSString *)givenName
familyName:(NSString *)familyName
otherName:(NSString *)otherNameOrNil
sex:(NSString *)sexOrNil
dateOfBirth:(NSDate *)dateOfBirthOrNil
playingPosition:(NSString *)playingPositionOrNil
rating:(NSNumber *)ratingOrNil
currentClub:(Club *)currentClubOrNil
previousClubs:(NSSet *)previousClubsOrNil
team:(Team *)teamOrNil
error:(NSError **)error;
Swift文件
let player1: Player = Player.methodInManagedObjectContext(moc, withGivenName: "Damien", familyName: "Laughton")
// let player2: Player = Player.newPl
我发现了this所以问题是什么问题是initWith:被swift转换但我无法找到自动完成中与我遗漏的方法签名匹配的任何方法......
任何人都可以对此有所了解吗?