Skip to content

Instantly share code, notes, and snippets.

View matoelorriaga's full-sized avatar

Matías Elorriaga matoelorriaga

View GitHub Profile
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 {
<?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>
import Foundation
extension Bool
{
static func random() -> Bool
{
return arc4random_uniform(2) == 0
}
}
import UIKit
extension UITextField
{
class func connectFields(fields:[UITextField]) -> Void
{
guard let last = fields.last else {
return
}
for i in 0 ..< fields.count - 1
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 #