Update README.md
A simple @State property wrapper.
@State
You could declare any variable as @State
@State var connecting = false
then you can listen for changes
connecting.listen { old, new in print("connecting var changed from \(old) to \(new)") } // or connecting.listen { new in print("connecting var changed from to \(new)") } // or even connecting.listen { print("connecting var changed") }
you can create a function with it
func test(_ state: State<Bool>) {}
and you can pass it into that function
test($connecting)
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
State
A simple
@Stateproperty wrapper.You could declare any variable as
@Statethen you can listen for changes
you can create a function with it
and you can pass it into that function