Reputation: 103
My project uses Swift and targets iOS 8.0 and newer, but we use some files from our old Objective-C project, and brings in some Objective-C libraries via CocoaPods. Which Realm interface should I use in this project: Objective-C or Swift? I'm confused because of the announcement in the Realm documentation:
If you’re looking to use Realm from Objective-C, or from mixed Objective-C & Swift apps please see Realm Objective-C instead. Using both Realm Objective-C and Realm Swift simultaneously is not supported.
Upvotes: 6
Views: 1432
Reputation: 9451
I would recommend that you use Realm Swift
only if you intend to use it from Swift otherwise you should use Realm Objective-C
. One of the reasons for this would be that at this point List
and RealmOptional
properties aren’t accessible from Objective‑C.
Upvotes: 0
Reputation: 9558
If you’re looking to use Realm purely from Swift, you should consider using Realm Swift instead. Using both Realm Objective-C and Realm Swift simultaneously is not supported.
Upvotes: 1
Reputation: 18308
They key detail is whether you intend to access your Realm model classes from only Swift, or both Swift and Objective-C. If you will only access them from Swift you can happily use Realm Swift, even if elsewhere in your application you use code written in Objective-C. If you will access your Realm model classes from both Swift and Objective-C code you'll need to use Realm Objective-C rather than Realm Swift.
Upvotes: 13