code
import SwiftUI
@main
struct swiftuiTestApp: App {
@State private var value = "a";
var body: some Scene {
WindowGroup {
Menu("menu") {
Picker("", selection: $value) {
Text("A").tag("a")
Text("B").tag("b")
Text("C").tag("c")
}
.pickerStyle(.inline)
.onChange(of: value) { oldValue, newValue in
print("onChange", newValue)
}
}
}
}
}
- on MacOS, onChange is not triggered when an option is selected for the first time, but subsequent option selections are triggered。
- on MacOS, when Picker is not inside Menu, it works fine
- on iOS, both works fine with inside or not inside menu
@chijun89 I tested this out and it looks like a bug on macOS! Can you please file a bug report at https://feedbackassistant.apple.com and add the code snippet. Please paste the FB number here.
Thanks