code written for access patterns. • Remove inconsistencies of @NSCopying. • Aimed at addressing problem of repeated property patterns like lazy. Dec, 2015
and refined with inspiration from Delegated Properties in Kotlin. • Known as Property Delegates. • Pitch #3 was submitted in May 2019. • Initializer renamed. • Name was changed to Property Wrappers. • Syntax refined.
Additional API that can exposed additional data var wrappedValue: T { get { // Custom logic for getter } set { // Custom logic for setter } } init(wrappedValue: T) {...} init(wrappedValue: T = Initial Value, additional params) {...} }
minimumValue: Int private var flexiInterest: Int var projectedValue: BondGrowth = .appreciating // The projected value projects the growth for the bond var wrappedValue: Int { get { return bondCurrentWorth } set { bondCurrentWorth = newValue + (newValue * flexiInterest/100) projectedValue = bondCurrentWorth < minimumValue ? .depriciating : .appreciating } } init(wrappedValue: Int = 0, minimumValue: Int, flexiInterest: Int) { self.minimumValue = minimumValue self.flexiInterest = flexiInterest self.bondCurrentWorth = wrappedValue } }