Popovers
Popovers copied to clipboard
iOS 16 issues
There seem to be some issues with UIViewRepresentable
s created multiple times in iOS 16 — see https://stackoverflow.com/questions/73016607/swiftui-button-label-rendered-twice.
Not sure when this started happening, but it seems like Button labels get duplicated now. Take this code:
struct ContentView: View {
@State var active = false
var body: some View {
Button {
active.toggle()
} label: {
Text("Toggle")
.onChange(of: active) { newValue in
print("Active changed to: \(newValue)")
}
}
}
}
It renders fine
, but check the console:
Active changed to: true Active changed to: true
Why is
Active changed to: true
printed twice?
This affects WindowReader
— the window gets stored in one of the duplicate view copies sometimes, and might not be correct until you scroll, rotate the device, or do a bounds change.
I've filed feedback FB10758896 (SwiftUI - button label rendered twice)