8000 GitHub - gametimesf/GTObservable: A simple wrapper to help observe property value changes in Swift
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

gametimesf/GTObservable

< 8000 /span>

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GTObservable

Use GTObservable as a wrapper around your propeties making it easy to subscribe to their changes.

Installation

Carthage compatible

Carthage

github "gametimesf/GTObservable" == 1.1

To use, simply:

    var observableLoggedIn = GTObservable<Bool>(false)

    // observe all future changes 
    observableLoggedIn.observe(self) { [weak self] update in
      print("your value changed from \(update.oldValue) to \(update.newValue)")
    }

    // observe all future changes AND fire with the current value at observation time  
    observableLoggedIn.fireThenObserve(self) { [weak self] _ in }
    
    // update the value 
    observableLoggedIn.value = true

Observers are safe, and will automatically unsubscribe when your observing object is deallocated.

About

A simple wrapper to help observe property value changes in Swift

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0