State

master

Swift @State
MihaelIsaev/State

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)

Description

  • Swift Tools 5.2.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Apr 11 2024 22:05:38 GMT-0900 (Hawaii-Aleutian Daylight Time)