-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
276 additions
and
26 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
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 @@ | ||
// | ||
// Array+MKHHelpers.swift | ||
// MKHHelpers | ||
// | ||
// Created by Maxim Khatskevich on 1/17/17. | ||
// Copyright © 2017 Maxim Khatskevich. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
//=== | ||
|
||
public | ||
extension Array | ||
{ | ||
mutating | ||
func removeFirst() -> Element? | ||
{ | ||
return (count > 0 ? remove(at: 0) : nil) | ||
} | ||
} |
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,45 @@ | ||
// | ||
// Stick.swift | ||
// MKHHelpers | ||
// | ||
// Created by Maxim Khatskevich on 1/20/17. | ||
// Copyright © 2017 Maxim Khatskevich. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
//=== | ||
|
||
public | ||
enum Stick | ||
{ | ||
@discardableResult | ||
public | ||
static | ||
func with<T: AnyObject>( | ||
_ object: T, | ||
configure: (_: T) -> Void | ||
) -> T | ||
{ | ||
configure(object) | ||
|
||
//=== | ||
|
||
return object | ||
} | ||
} | ||
|
||
//=== | ||
|
||
infix operator <| | ||
|
||
@discardableResult | ||
public | ||
func <| <T: AnyObject>(object: T, configure: (_: T) -> Void) -> T | ||
{ | ||
configure(object) | ||
|
||
//=== | ||
|
||
return object | ||
} |
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,25 @@ | ||
// | ||
// UIButton+MKHHelpers.swift | ||
// MKHHelpers | ||
// | ||
// Created by Maxim Khatskevich on 1/17/17. | ||
// Copyright © 2017 Maxim Khatskevich. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
//=== | ||
|
||
public | ||
extension UIButton | ||
{ | ||
@discardableResult | ||
func image(_ i: UIImage?, for state: UIControlState = .normal) -> Self | ||
{ | ||
setImage(i, for: state) | ||
|
||
//=== | ||
|
||
return self | ||
} | ||
} |
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,25 @@ | ||
// | ||
// UIStackView+MKHHelpers.swift | ||
// MKHHelpers | ||
// | ||
// Created by Maxim Khatskevich on 1/20/17. | ||
// Copyright © 2017 Maxim Khatskevich. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
//=== | ||
|
||
@available(iOS 9.0, *) | ||
public | ||
extension UIStackView | ||
{ | ||
@discardableResult | ||
func sv(_ views: UIView...) | ||
{ | ||
for v in views | ||
{ | ||
addArrangedSubview(v) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.