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
import UIKit | |
extension UIViewController { | |
func smoothlyDeselectRows(tableView: UITableView?) { | |
let selectedIndexPaths = tableView?.indexPathsForSelectedRows ?? [] | |
if let coordinator = transitionCoordinator { | |
coordinator.animateAlongsideTransition(in: parent?.view, animation: { context in | |
selectedIndexPaths.forEach { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="material_red50">#ffffebee</color> | |
<color name="material_red100">#ffffcdd2</color> | |
<color name="material_red200">#ffef9a9a</color> | |
<color name="material_red300">#ffe57373</color> | |
<color name="material_red400">#ffef5350</color> | |
<color name="material_red500">#fff44336</color> | |
<color name="material_red600">#ffe53935</color> |
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
import Foundation | |
extension Bool | |
{ | |
static func random() -> Bool | |
{ | |
return arc4random_uniform(2) == 0 | |
} | |
} |
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
import UIKit | |
extension UITextField | |
{ | |
class func connectFields(fields:[UITextField]) -> Void | |
{ | |
guard let last = fields.last else { | |
return | |
} | |
for i in 0 ..< fields.count - 1 |
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
import UIKit | |
extension UIColor | |
{ | |
convenience init(hex: String, alpha: CGFloat = 1) | |
{ | |
assert(hex[hex.startIndex] == "#", "Expected hex string of format #RRGGBB") | |
let scanner = Scanner(string: hex) | |
scanner.scanLocation = 1 // skip # |