Latest 0.1.2
License MIT
Platforms ios 8.0


It is very convenient to make objects’ customizations using closures

let change: (UIView) -> Void = { (view: UIView) in
    view.alpha = 0.5
    view.backgroundColor = UIColor.white

and apply them to an object when necessary

let view = UIView()

Keep reading if you also find it convenient!

Table of contents


Look is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Look', '0.1.2'


Look is a generic structure with a reference to an object

struct Look<T> {
    let object: T

that can be accessed from any object

let view = UIView()
let look: Look<UIView> = view.look

Look should be used to apply objects’ changes and states.


Look framework introduces a generic typealias which describes such closures

Change<T> = (T) -> Void

and a generic static function that helps to construct changes

let change = UIView.change { (view) in
    view.alpha = 0.5
    view.backgroundColor = UIColor.white

Combine changes

Changes can be combined using + operator

let changeAlpha: Change<UIView> = UIView.change { (view) in
    view.alpha = 0.5
let changeText: Change<UILabel> = UILabel.change { (view) in
    view.text = "text"
let change: Change<UILabel> = changeAlpha + changeText

Apply changes

There are some ways to apply changes to an object in addition to a simple way


Using look and apply function


Using look and + operator

view.look + changeAlpha + changeColor


State is a new parameter of an object that is introduced by Look framework and can be accessed only through look structure

extension Look {
    var state: AnyHashable? { get set }

Whenever an object is changed you can also change its state in order to apply predefined changes.

Predefined changes

Let’s imagine that we have different changes that should be applied to a view

let changeDisabled = UIView.change { (view) in
    view.alpha = 0.5
    view.layer.borderColor =
let changeEnabled = UIView.change { (view) in
    view.alpha = 1.0
    view.layer.borderColor =

These changes can be predefined with some names

view.look.prepare(states: "disabled", "initial", change: changeDisabled)
view.look.prepare(state: "enabled", change: changeEnabled)

and applied by changing object’s state

view.look.state = "disabled"

Delayed preparation

Sometimes, object’s state is defined before the state’s change is prepared

view.look.state = "some state"
view.look.prepare(state: "some state", change: someChange)

In such cases a change would be applied to an object during preparation and there is no need update object’s state.


[email protected]


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

Latest podspec

    "name": "Look",
    "version": "0.1.2",
    "summary": "Elegant UIView customizations in Swift",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "izhs": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.2"
    "platforms": {
        "ios": "8.0"
    "source_files": "Look/Classes/**/*",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This