AssociatedValues allows you to easily add stored properties in class extensions:
extensionUIView{varidentifier:String{get{returngetAssociatedValue(key:"identifier", object:self, initialValue:"Unknown")}set{set(associatedValue: newValue, key:"identifier", object:self)}}}Enjoy!
AssociatedValues is available through CocoaPods. To install, simply include the following lines in your podfile:
use_frameworks!pod'AssociatedValues'Be sure to import the module at the top of your .swift files:
import AssociatedValuesAlternatively, clone this repo or download it as a zip and include the classes in your project.
Brad Hilton, brad@skyvive.com
AssociatedValues is available under the MIT license. See the LICENSE file for more info.