I have a WatchKit extension to my app and I need to modify the data in the content view with updates from the app on the phone. So I am using the code below... but the compiler errors out saying it can find UViewControllerRepresentable in scope
struct ContentView: View, UViewControllerRepresentable
{
var body: some View {
VStack
{
...
}
}
UIViewControllerRepresentable
is not available for watch.
https://developer.apple.com/documentation/swiftui/uiviewcontrollerrepresentable
There is no need because WatchKit/WatchOS doesn't have UIViewController
s
https://developer.apple.com/documentation/uikit/uiviewcontroller
SwiftUI View
s are available but you can't use UIKit
's UIView
s/UIViewController
s
Whenever you have to redesign a View
for a watchOS compatible version you can name it the same as the iOS
target's version and give it the same init
.
If you keep the target memberships selected appropriately the compiler will chose the current target's version.