1
私は迅速な構造体を_ObjectiveCBridgeableに準拠させようとしていますが、私はプロトコルを満たすために他に何が必要なのか分かりません。以下は私の構造体と_ObjectiveCBridgeableの適合です。私は何かが欠けているが、それが何であるか分からない。 //にObjCswift 3 _ObjectiveCBridgeable適合
@interface thing : NSObject
@property (readonly) id contents;
-(instancetype)initWithContents:(id)contents;
@end
@implementation thing
- (instancetype)initWithContents:(id)contents {
if ((self = [super init])) {
_contents = contents;
}
return self;
}
@end
しかし、あなたはhttp://stackoverflow.com/questions/38837198/define-struct-that-is-treated-like-a-class-in-swiftを見てみたいかもしれません(そのうちの質問はおそらく、複製)。 – matt
まあ、Xcodeでは、 ''(Box._ObjectiveCType?) - > Box 'タイプの関数' _unconditionallyBridgeFromObjectiveC 'を実装する必要があると言います。しかし、私はどのように困惑しています。 – DerrickHo328
私はそれが私的だと気づいていますが、それ以前のバージョンのswiftではうまくいきました。 – DerrickHo328