I measure the child view size and pass it to the parent view using preference technic. Time by time I get the next message in console Bound preference WidthKey tried to update multiple times per frame.
Nothing happens in terms of errors or an unexpected behavior.
I get that the nature of TextField is asynchronous and this is might be the reason The question is could it be the problem in more complex examples, layouts ?! or it's just an information about the behavior
there are video examples reproducing the message
Nothing happens in terms of errors or an unexpected behavior.
I get that the nature of TextField is asynchronous and this is might be the reason The question is could it be the problem in more complex examples, layouts ?! or it's just an information about the behavior
there are video examples reproducing the message
Code Block import SwiftUI struct ContentView: View { @State var width: CGFloat? = nil @State var myText : String = "Text" var body: some View { VStack{ TextField("Mytext", text: $myText) Spacer() Text("\(myText)") .background( GeometryReader{ proxy in Color.clear.preference(key: WidthKey.self, value: proxy.size.width) } ) .fixedSize() .frame(width: 200, height: 200) .onPreferenceChange(WidthKey.self){self.width = $0 } } } } struct WidthKey: PreferenceKey { static var defaultValue: CGFloat? = nil static func reduce(value: inout CGFloat?, nextValue: () -> CGFloat?) { value = value ?? nextValue() } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }