How can I reference the Swift class in my WatchKit extension from main iOS code?

I am trying to have an iOS application send WatchKit Extension a data set every time the data is updated from the server.

This is what the code looks like in my iOS app (names changed)

[WatchKitDataModel loadDataFromSource: currentData]

However, the iOS application does not recognize WatchKitDataModel.

The error is the use of an undeclared modifier.

Please help me make my apps talk to each other!

+4
source share
2 answers

Make sure your violation class is added to both the application target and the WatchKit target in the Document panel

enter image description here

TodayExtension, .

+8

WatchKit Extension , . Apple , .

Xcode 6, > > .... iOS > a > Cocoa Touch Framework. . SomethingKit, , Apple , . UIKit, HealthKit, WatchKit. Framework. , WatchKit Extension , import SomethingKit.

, public Framework.

Frameworks , , Framework, . Apple: .

WWDC 2014 : .

+1

All Articles