Skip to content

Instantly share code, notes, and snippets.

@iby
Last active September 30, 2018 20:52
Show Gist options
  • Save iby/a180f44706d0d71cf0cfd5c45bd119a9 to your computer and use it in GitHub Desktop.
Save iby/a180f44706d0d71cf0cfd5c45bd119a9 to your computer and use it in GitHub Desktop.
extension Reactive {
/// A proxy which holds reactive binding target extensions of `Base`.
struct Binds<Base> {
fileprivate init(_ base: Base) { self.base = base }
let base: Base
}
var bind: Binds<Base> { return Binds(self.base) }
/// A proxy which holds reactive signal extensions of `Base`.
struct Signals<Base> {
fileprivate init(_ base: Base) { self.base = base }
let base: Base
}
var signal: Signals<Base> { return Signals(self.base) }
/// A proxy which holds reactive signal producer extensions of `Base`.
struct Producers<Base> {
fileprivate init(_ base: Base) { self.base = base }
let base: Base
}
var producer: Producers<Base> { return Producers(self.base) }
}
extension Reactive.Binds where Base: ReactiveExtensionsProvider {
/// Convenience `self.base.reactive` accessor.
var reactive: Reactive<Base> { return self.base.reactive }
}
extension Reactive.Signals where Base: ReactiveExtensionsProvider {
/// Convenience `self.base.reactive` accessor.
var reactive: Reactive<Base> { return self.base.reactive }
}
extension Reactive.Producers where Base: ReactiveExtensionsProvider {
/// Convenience `self.base.reactive` accessor.
var reactive: Reactive<Base> { return self.base.reactive }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment