Reputation: 152
I am working on a Mac app written in Swift. In order to execute some code on login, I created a helper app. The helper app needs to access data from the main app. Thus, I enabled "App Groups" for both main and helper app, to share data via UserDefaults
. So far, so good.
I started to create the model for my data in the main app and just realized that I have no clue how to teach the helper app about the model.
So, how do I implement my model into both apps?
Upvotes: 0
Views: 42
Reputation: 1127
You can only share raw data between two apps, not application logic.
So I think the best solution for your case is following: Extract your model sourcecode into a framework and embed it into both applications. The model only uses the shared raw data and should be stateless.
But note: When changing the model you have to ensure that both apps will be updated or you might get a compatibility issue. So maybe you should version your model and check the version first before using it.
Upvotes: 1