目录
目录README.md

State

A simple @State property wrapper.

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)
关于
32.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号