问题
I have an app written in ObjC. I've chosen Realm as my DataBase.
I would like to start migrating some parts of my app to Swift.
When getting to Realm I get confused.
There are two pods
. From what I understood from the docs, RealmSwift is for pure Swift projects, right?
But, is it possible to migrate model classes to Swift without the RealmSwift pod
?
回答1:
As I understand it, Realm Swift isn't exclusive for pure Swift projects, but if you do use it in an iOS app, you can't make any calls to it from any Objective-C code. So if you plan to move all of your Realm code to Swift, then it should be okay.
If you've still got any Realm code in Objective-C, then it would be better to stick with the Realm Objective-C framework, and make any Swift calls via the Swift bridging header.
Realm files are very platform independent, so if you simply rewrote the Objective-C model classes in Swift, as long as the model properties and types were exactly the same, it should still simply work.
来源:https://stackoverflow.com/questions/36961251/realm-migrating-from-objc-to-swift