How sharing the model of the main app with WatchOS2?

217 Views Asked by At

I need to share my entities (CoreData) of the main app with WatchOS2.

There are two ways to share code between targets - frameworks, and just including the .m or .swift file in multiple targets using Xcode's inspector.

WatchOS2 can create a dynamic framework and the main app too.

I have tried to create a dynamic framework in the main app and share code with WatchOS 2 : `Not such module TestFrameworkKit'.

Framework isn't going to work with a watchOS 2 extension because that extension runs on a completely different device.

Any idea ?

1

There are 1 best solutions below

0
On

I just add the .swift and .m files to both targets and this works great. Since the iOS and watch app need to be in the same project anyways, this is a very appropriate solution. I would only look into adding frameworks if you need to share code between projects.