Issue using RealmSwift in a framework versus using it in an app

If I install RealmSwift into an ios app using SPM, I have no problems. However if I install it into an ios framework, then when building there is this error:

error: missing required modules: 'Realm.Private', 'Realm', 'Realm.Swift'

I have discovered that if I change the import statement from: import RealmSwift to private import RealmSwift

then doing that makes this build error goes away (but doing that isn't a feasible workaround as I would like to publicly export classes stored in Realm from the framework).

There's no point in posting issues with Realm on their support board as its being deprecated and its tumble weeds on their forum.

But I would be very interested in hearing from the Apple expects explanation or speculation on:

  • why is importing the same framework via SPM into a framework xcode project resulting in different behavior then when importing it into an app?
  • why would changing import to private import make the build error go away?

TIA

Issue using RealmSwift in a framework versus using it in an app
 
 
Q