What's difference between them? Could you give me an example of in which scenario I should use dynamic/mutable/any/constants property?
All your answer are in this link Property.swift
I give you some examples:
let privatString = MutableProperty<String>("PrivatString")
    // AnyProperty are only for observing. You can't change it with observableProperty.value
    let observableProperty: AnyProperty = AnyProperty<String>(privatString)
    print(observableProperty)
    // ConstantProperty describes observable constant value.
    let constantProperty = ConstantProperty<String>("ConstantString")
    //  constantProperty.value = "" Error
    // Thread safe observable mutable property. It's value is changable
    let mutableProperty = MutableProperty<String>("mutableProperty")
    mutableProperty.value = "New mutable property value"
    // DynamicProperty uses KVO. 
    let dynamicProperty = DynamicProperty(object: self.view.layer, keyPath: "bounds")
    dynamicProperty.producer.startWithNext { frame in
        let frame = frame as! NSValue
        let rect = frame.CGRectValue()
        print(rect)
    }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With