-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
General do, UIButton.font, UIGestureRecognizer.action with object
- Loading branch information
Showing
5 changed files
with
74 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// Do.swift | ||
// Panda | ||
// | ||
// Created by Javier on 11/2/16. | ||
// Copyright © 2016 Javier. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public protocol Doable {} | ||
|
||
extension Doable { | ||
@discardableResult | ||
public func `do`(_ action: (Self) -> ()) -> Self { | ||
action(self) | ||
return self | ||
} | ||
} | ||
|
||
extension NSObject: Doable {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// UIButtonExtensions.swift | ||
// Panda | ||
// | ||
// Created by Javier on 11/2/16. | ||
// Copyright © 2016 Javier. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension UIButton { | ||
@discardableResult | ||
public func font(_ value: UIFont?) -> Self { | ||
titleLabel?.font = value | ||
return self | ||
} | ||
} |