In ObjC all classes have a zero-argument constructor (aka the default constructor), but that's not true in Swift. To work around this, when generating the ObjC wrapper header for a Swift class, the swift compiler annotates the default constructor with SWIFT_UNAVAILABLE:
SWIFT_CLASS("_TtC17BasicSwiftWrapper10DogWrapper")
@interface DogWrapper : NSObject
@property (nonatomic, copy) NSString * _Nonnull name;
@property (nonatomic, copy) NSString * _Nonnull breed;
- (nonnull instancetype)initWithName:(NSString * _Nonnull)name breed:(NSString * _Nonnull)breed OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
Currently ffigen doesn't see the SWIFT_UNAVAILABLE annotation, so it generates the default constructor anyway. When the user tries to call this ctor, they get a runtime exception in swift.
So we need to parse this annotation and omit any initializers/methods that have it.
Also, it's possible that parts of ffigen are assuming that all ObjC classes have a default constructor, so we'll have to be on the look out for that.