This IOS app has the watchOS app included, the sending function works an is displayed on the watch, and the Counter counts on the IOS app, now I am wondering if there is an easy way to display the counted numbers on the watch, this is the ContentView Code.
Devices
import SwiftUI
struct ContentView: View {
var model = ViewModelPhone()
@State var reachable = "No"
@State var Message = ""
@State var GolfCount :Int = 0
var body: some View {
VStack{
Text("Reachable \(reachable)")
Button(action: {
if self.model.session.isReachable{
self.reachable = "Yes"
}
else{
self.reachable = "No"
}
}) {
Text("Update")
}
//mesage input
TextField("Input your message", text: $Message)
.padding(100)
Button(action: {
//message sending
self.model.session.sendMessage(["message" : self.Message], replyHandler: nil) { (error) in
print(error.localizedDescription)
}
}) {
Text("Send")
} //golf Counting
Button(action: {
GolfCount += 1
})
{
Text("Schläge")
Text(String(GolfCount))
}}}}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
'''