Using The .focusedValue Modifier and @FocusedBinding Property Wrapper In SwiftUI
Daily Coding Tip 041

This is a new way to pass data between Views. Instead of having an ObservableObject
, we save data using a FocusedValueKey
.
In the following example, DisplayTextView
is able to show the text you type into TextFieldView
, despite the fact that a Binding<String>
or String
constant is not passed between the Views.
Keep reading with a 7-day free trial
Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.