DominicMDev / AssociatedValues

Associated Objects For Swift Values

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AssociatedValues

AssociatedValues allows you to easily add stored properties in class extensions:

extension UIView {
  var identifier: String {
      get {
          return getAssociatedValue(key: "identifier", object: self, initialValue: "Unknown")
      }
      set {
          set(associatedValue: newValue, key: "identifier", object: self)
      }
  }
}

Enjoy!

Installation

AssociatedValues is available through CocoaPods. To install, simply include the following lines in your podfile:

use_frameworks!
pod 'AssociatedValues-DominicMDev'

Be sure to import the module at the top of your .swift files:

import AssociatedValues

Alternatively, clone this repo or download it as a zip and include the classes in your project.

Author

Brad Hilton, brad@skyvive.com

License

AssociatedValues is available under the MIT license. See the LICENSE file for more info.

About

Associated Objects For Swift Values

License:MIT License


Languages

Language:Swift 76.3%Language:Ruby 20.2%Language:C 3.5%