2

I want to Use Realm-objective-c with RLMSupport.swift under swift 4.1, But this code fragment:

for model in banners {
    // do some stuff
}

banners is a RLMArray of instances of BannerModel, which defined in Objective-C. The definition like this:

@interface BannerModel : RLMObject
// iid
@property NSString* _Nonnull iid;
@end
RLM_ARRAY_TYPE(BannerModel)

got this compile error:

'RLMArray & BannerModelProtocol' cannot be used as a type conforming to protocol 'Sequence' because 'Sequence' has static requirements

My Xcode is 9.4; Swift 4.1 and I have tried:

Realm-Objc version 3.6.0 and 3.7.4 with:

pod 'Realm' , '~> 3.6.0'
pod 'Realm' , '~> 3.7.0'

I have add the corresponding RLMSupport.swift. Still got the same compile error.

Any ideas? Thanks!

振华蒋
  • 21
  • 1

0 Answers0