Reactive

@dynamicMemberLookup
public struct Reactive<Base>

Use Reactive proxy as customization point for constrained protocol extensions.

General pattern would be:

// 1. Extend Reactive protocol with constrain on Base // Read as: Reactive Extension where Base is a SomeType extension Reactive where Base: SomeType { // 2. Put any specific reactive extension for SomeType here }

With this approach we can have more specialized methods and properties using Base and not just specialized on common base type.

Binders are also automatically synthesized using @dynamicMemberLookup for writable reference properties of the reactive base.

  • Base object to extend.

    Declaration

    Swift

    public let base: Base
  • Creates extensions with base object.

    Declaration

    Swift

    public init(_ base: Base)

    Parameters

    base

    Base object.

  • Automatically synthesized binder for a key path between the reactive base and one of its properties

    Declaration

    Swift

    public subscript<Property>(dynamicMember keyPath: ReferenceWritableKeyPath<Base, Property>) -> Binder<Property> where Base : AnyObject { get }