Realm-cocoa: Use both RealmSwift and Objective-C Realm in same project

Created on 23 Aug 2017  路  1Comment  路  Source: realm/realm-cocoa

I'm trying to use both RealmSwift and Objective-C Realm in same project

I'm working on a project written in Objective-C, and I'm migrating it to Swift part by part
objective-c models are based on Realm Objective-C, I want to make new models written in swift to use RealmSwift, I know I can use swift with Objective-C Realm but I don't want to
my plan is by the end of the migrating from objective-c to swift I will delete Realm Objective-C and use RealmSwift only
any ideas on how I can achieve that ?

T-Help

Most helpful comment

What you're asking for is not supported. To quote from the first paragraph of the Realm Swift documentation:

If you鈥檙e looking to use Realm from Objective鈥慍, or from mixed Objective鈥慍 & Swift apps, please see Realm Objective鈥慍 instead. The Realm Objective鈥慍 and Realm Swift APIs are not interoperable and using them together is not supported.

I'd suggest using Realm Objective-C from Swift as you migrate your codebase to Swift, and then switching over to Realm Swift once your model classes are no longer accessed from Objective-C.

>All comments

What you're asking for is not supported. To quote from the first paragraph of the Realm Swift documentation:

If you鈥檙e looking to use Realm from Objective鈥慍, or from mixed Objective鈥慍 & Swift apps, please see Realm Objective鈥慍 instead. The Realm Objective鈥慍 and Realm Swift APIs are not interoperable and using them together is not supported.

I'd suggest using Realm Objective-C from Swift as you migrate your codebase to Swift, and then switching over to Realm Swift once your model classes are no longer accessed from Objective-C.

Was this page helpful?
0 / 5 - 0 ratings