Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gpape/CollectiveSwift

Repository files navigation

CollectiveSwift

A small quality-of-life enhancement for practical UIKit development in Swift.

I often find myself writing, e.g.:

someViews.forEach {
    $0.tintColor = someColor
}

CollectiveSwift enables the equivalent:

someViews.all.tintColor = someColor

This goes nicely with outlet collections from storyboards.

Extensions for a few common properties are included, but it's easy to add your own. For example:

extension Collective where Element: MyObject {

    var someProperty: Bool {
        get { Collective.gettersAreNotSupportedFailure() }
        set { base.forEach { $0.someProperty = newValue } }
    }

}

License

MIT

About

Enables a concise syntax for setting properties on collections of Swift/UIKit objects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published