Skip to content

ZionChang/Together

Repository files navigation

Together

Swift Version Pod Version Carthage compatible License Platform

🍺Object common properties setting for swift.

##Usage

###SystemClass

let view1 = UIView()
let view2 = UITextField()
let view3 = UIImageView()
let alpha: CGFloat = 0.5

use together set their common properties

view1.together(values: view2, view3).do {
	$0.alpha = alpha
}

This is equivalent to:

view1.alpha = alpha
view2.alpha = alpha
view3.alpha = alpha

###CustomClass

class Person {
    var firstName: String?
    var lastName: String?
}

class Coder: Person {
    var language: String?
}
// remember!!
extension Person: TogetherCompatible {}

let person1 = Person()
let person2 = Person()
let person3 = Person()
let coder = Coder()
let lastName = "Zhang"
    
person1.together(values: person2, person3, coder).do {
    $0.lastName = lastName
}

Installation

###Carthage Create a Cartfile that lists the framework. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/Together.framework to an iOS project.

github "eilianlove/Together"

Run carthage update to build the framework and drag the built Together.framework into your Xcode project.

To get the full benefits import Together

import Together

###CocoaPods

You can use CocoaPods to install Together by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'Together', '~> 1.0.0'

Then, run the following command:

$ pod install

Manually

  1. Download and drop Together in your project.
  2. Congratulations!

About

Object common properties setting for swift.

Resources

License

Stars

Watchers

Forks

Packages

No packages published