What does the SwiftUI `@State` keyword do?

前端 未结 5 1725
后悔当初
后悔当初 2020-12-08 13:34

The SwiftUI tutorial uses the @State keyword to indicate mutable UI state:

@State var showFavoritesOnly = false

It offers this summ

5条回答
  •  醉酒成梦
    2020-12-08 14:02

    If you know about C# and windows development. @State is similar if not the same as x:Bind or Binding.. On a collection it is similar if not the same as ObservableCollection.

    As fredpi said, SwiftUI is listing for updates on vars with the @State property delegate.

提交回复
热议问题