TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Oct 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✗ |
Maintained by ‘Beeth0ven --description=‘Mac Mini.
A better way to deal function with weak reference.
Function without return value:
button.rx.tap
.subscribe(onNext: weak(self) { me in me.showAlert() })
...
is equivalent to:
button.rx.tap
.subscribe(onNext: { [weak self] in
guard let me = self else { return }
me.showAlert()
})
...
Function with return value:
let searchResults = rxText
.flatMapLatest(weak(self, default: .empty()) { me, text in
me.searchGitHub(text)
})
is equivalent to:
let searchResults = rxText
.flatMapLatest { [weak self] text -> Observable<[Repository]> in
guard let me = self else { return .empty() }
return me.searchGitHub(text)
}
For iOS 8+ projects with CocoaPods:
pod 'WeakOwner'
For iOS 8+ projects with Carthage:
github "beeth0ven/WeakOwner"
WeakOwner is under MIT license. See the LICENSE file for more info.