JS_is_awesome18
JS_is_awesome18

Reputation: 1757

How to setup SwiftUI app file to allow independent app to deploy on WatchOS 6

I am attempting to deploy a SwiftUI app to an Apple Watch Series 2 with WatchOS 6.3, from an iPhone running iOS 15. After connecting the device to Xcode and clicking the build button, I get errors that indicate @SceneBuilder, Scene, WindowGroup, and NavigationView are only " only available in application extensions for watchOS 7.0 or newer". Is there a way to configure this file (or some other part of the Xcode environment) to enable the app to work with WatchOS 6.3 or lower?

See the screenshot below. Thanks!

enter image description here

Upvotes: 1

Views: 345

Answers (1)

kelin
kelin

Reputation: 12021

Please, check out official example: Developing a User Interface with SwiftUI. Basically you need to create storyboard-based interface and put a WKHostingController there (see InterfaceController.swift above). And there you will load SwiftUI view. You may also look at WWDC 2019 video #219: SwiftUI on watchOS.

Upvotes: 0

Related Questions