2016-03-24 7 views
-1

私はObjective-cプロトコルを持っています。このプロトコルでは、Swift構造体の型であるプロパティを宣言する必要があります。これをどのように機能させるには?Objective-cプロトコルのプロパティとしてswift structを使用するには?

SomeObjectiveCProtocol.h:

@protocol SomeObjectiveCProtocol <NSObject> 
    @property (nonatomic, readonly) SomeSwiftStruct swiftStruct; 
@end 

もかのうこのようなものですか?

答えて

0

私は、プロトコルの前方宣言とそれを把握します。私は定義されて

SomeSwiftProtocol.swift:

protocol SomeSwiftProtocol { 
    // some protocol requirements 
} 

SomeSwiftStruct.swift:

@protocol SomeSwiftProtocol; 

@protocol SomeObjectiveCProtocol <NSObject> 
    @property (nonatomic, readonly) id<SomeSwiftProtocol> swiftStructProtocol; 
@end 
struct SomeSwiftStruct: SomeSwiftProtocol { 
    // SomeSwiftProtocol implementation 
} 

とSomeObjectiveCProtocol.hに比べ

関連する問題