Post

Replies

Boosts

Views

Activity

SwiftUI's onAppear acting differently on Watch 10 devices
Hi, with the recent watchOS10 update, I have found a strange behavior on watchos10 devices. Before watchOS10, fullScreenCovers on a view, when being dismissed, did not trigger the onAppear function of the underlying view, to which the fullScreenCover is attached to. However, on watchOS 10.2 devices, I have noticed that onAppear is triggered in the same situation. Thus my app is showing unexpected behavior. On a simulator, the onAppear is acting as before but the new behavior is seen on real devices. Could this be a change to the onAppear mechanism on Apple watch devices? Or would this be a bug?
1
0
422
Jan ’24
SwiftUI/WatchOS - Picker inside a ScrollView does not work as expected
What I am trying to build Apple Watch app(written in SwiftUI, targeting watchOS 7 or higher, built with Xcode 14.1) The Problem Picker placed inside a ScrollView on an apple watch device does not work as expected I want to find out how to get the Picker to work as expected, stated below. Expected behavior On an iOS simulator, a Picker inside a ScrollView works as expected. If I try scroll interaction on the Picker area, the ScrollView part doesn’t get scrolled and only the Picker gets scrolled. whereas on the watch simulator Example, 

 If I try to scroll the Picker by touching the Picker area, the whole ScrollView reacts and moves up and down. And I am not able to control the Picker properly. The code I wrote is as follows: ScrollView { //..other view elements.. Picker(selection: $currentDay) { ForEach(weekDays, id: \.self) { Text($0) } } label: { Text("") } .frame(width: 148,height: 50) .pickerStyle(.wheel) //..other view elements.. }//: ScrollView Things I have tried putting the Picker inside a VStack/ZStack/HStack giving the Picker fixed frame values / giving other elements inside the ScrollView fixed frame values
1
0
1.7k
Dec ’22
Is updateApplicationContext supposed to trigger didReceiveApplicationContext?
Hi, I am working on an apple watch app project linked to an iOS App(made with React-native). I realized that when I update the current applicationContext from the watch-side with the updateApplicationContext function, the didReceiveApplicationContext function also gets triggered on the watch-side. I was not expecting updating the applicationContext to trigger the receiving function. Is this behavior expected? Or could it be that I'm missing something while setting up the WCSession singleton object? This is my code for the singleton connectivity object. extension ConnectivityProvider {  // function to update applicationContext  func update(applicationContext: [String: Any]) -> Void {   DispatchQueue.main.async {    do {     print("applicationContext update")     try self.session.updateApplicationContext(applicationContext)     print("new applicationContext: \(applicationContext)")    } catch {     print("applicationContext update failed")    }   }  }     // function to receive applicationContextUpdate func session(_ session: WCSession, didReceiveApplicationContextapplicationContext: [String: Any]) -> Void {   DispatchQueue.main.async {    print("updated context from couterpart: \(applicationContext)")   }  } } Thank you in advance for your help.
2
0
722
Nov ’22