Search code examples
iosswiftrealmreactive-swift

Similar types: Cannot specialize a non-generic definition


I have a Controller where I need to import two pods.

import Realm
import ReactiveSwift

Problem is that both have a type named Property.

Now if I use that with importing both pods then it gives me compile time error Cannot specialize a non-generic definition.

For workaround,

I created a separate file and added extension to controller with importing Realm in that only. And kept ReactiveSwift in controller file. This helps me to prevent the error. But is this the best way?


Solution

  • In order for the compiler to be able to decide which Property element you want to use, you have to add the namespace. In this case:

    • Realm.Property to use the Property element from Realm
    • ReactiveSwift.Property to use the Property element from ReactiveSwift