I created a simple iOS framework Swift project and added a single Swift class Logger
with a single stub method log(_:)
class Logger: NSObject {
func log(_ message:String) {
// ...
}
}
The Logger
class and log
method are internal to the framework, and building normally does not expose them to ObjC
. If I check the "Allow app extension API only" in the General settings of my framework target, though, the generated MyFramework-Swift.h
now contains both the class and method declaration, meaning that both are visible to consumers of the framework as if they were declared public:
SWIFT_CLASS("_TtC9Framework6Logger")
@interface Logger : NSObject
- (void)log:(NSString * _Nonnull)message;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
Can someone please explain why? Thanks in advance!