watchOS app integration
Integrating Appfigurate Library into watchOS apps
Last updated
Integrating Appfigurate Library into watchOS apps
Last updated
watchOS apps can be developed in both Swift and Objective-C.
Independent watchOS apps are not supported, watchOS apps must be bundled inside a companion iOS app. (The companion iOS app's Appfigurate Library is used to proxy any configuration payloads applied to the watchOS app).
You must perform the following before starting watchOS native integration:
of Appfigurate Library.
In addition to the , you must also have:
watchOS SDKs and associated watchOS Simulators.
Use paired iOS and watchOS Simulators.
Appfigurate Simulator app installed into one or more paired iOS Simulators (use the for easy 1 click installation).
Your watchOS app must target watchOS 5.0+ in order to link Appfigurate Library.
In Xcode:
Tap on your watchOS app target.
Tap the General tab. Tap the +
button under the Frameworks, Libraries, and Embedded Content
section.
Select AppfigurateLibrary
package.
Run Appfigurate in the paired iOS Simulator.
Select app type watchOS
.
Tap Duplicate
.
Swift
WKApplicationDelegate
example
Swift
WKApplicationDelegateAdaptor
example
Swift
WCSessionDelegate
example
To test that you've successfully updated your watchOS app to use Appfigurate:
Compile and run your watchOS app to the paired Simulator instance.
Launch the Appfigurate Simulator app.
Tap your watchOS applications row. The companion iOS app will be run and made visible. The companion iOS app will read the watchOS apps configuration, then swap back to Appfigurate.
Tap ≡
YOUR-IOS-APP
app. The screen will be displayed.
Tap Duplicate row
row. The screen will be displayed.
Share the iOS app's subclass with the watchOS app extension.
Open your subclass (e.g. Configuration.swift/m
file) into the Xcode editor. In the Target Membership
inspection pane tick on your watchOS app target.
For watchOS apps using SwiftUI, you must call in the 's method.
Ensure you use the property wrapper inside your declaration to tell SwiftUI about the delegate type:
For watchOS apps using Storyboards, you must call in the 's method.
You must call in the 's method.
If your watch app has an existing WCSessionDelegate
, then you must add a call to the method. If your watch app does not have a WCSessionDelegate
then a default implementation is automatically provided.
Appfigurate's screen will now be displayed. You can now change the debugLogging
and serverURL
properties. Tap Apply⌄
to apply the configuration to your watchOS app.
Now jump to .