内部类存在于混合框架的自动生成的头中

时间:2017-01-27 07:49:36

标签: ios objective-c swift ios-frameworks

根据Apple有关内部访问修饰符的文档:

 For framework targets, only declarations with the public or open 
 modifier appear in the generated header. 

现在我正在编写一个具有客观C& C的混合框架。迅速。在其中我定义了一个快速的类:

import Foundation

@objc(Utility)

internal class Utility:NSObject{

   internal func getMyName() -> String
   {
      return "Got the name!"
   }

}

但我仍然能够在框架的自动生成标题中看到这一点:

SWIFT_CLASS_NAMED("Utility")
@interface Utility : NSObject
- (NSString * _Nonnull)getMyName;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end

这是在Xcode 8.2.1上,任何想法为什么它不按照文档声明行事。

1 个答案:

答案 0 :(得分:0)

我参考了这篇文章https://stackoverflow.com/a/37324966/1242077,并标记了检查"仅允许应用扩展程序API"因此它甚至列出了内部的课程和自动生成标题中的方法。

我使用此解决方案来保持Class私有:https://stackoverflow.com/a/33159964/1242077