Post

Replies

Boosts

Views

Activity

How do you pass SwiftUI Bindings to other objects in iOS 13 Beta 4?
In Xcode 11 Beta 4, I'm no longer able to pass `Binding`s down a view hierarchy. For example, imagine I have a list view called `CoolListView`, which renders multiple `CoolListRow` subviews, and the user is able to change a value from the list superview level that I'd like to percolate down to and update the row subviews:public struct CoolListRow : View { @Binding var currentStep: Int public var body: some View { // ... } public init(currentStep: Binding<Int>) { self.$currentStep = currentStep } }In Beta 3 and earlier, I would be able to pass this `Binding` as an argument to my subviews, but now in Beta 4, Xcode complains `Cannot assign to property: '$currentStep' is immutable`. Any ideas on how to resolve this?
5
1
29k
Jul ’19