Skip to content

Instantly share code, notes, and snippets.

Matías Elorriaga matoelorriaga

Block or report user

Report or block matoelorriaga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View UIViewController+Extensions.swift
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 {
View colors.xml
<?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>
View Bool+Extensions.swift
import Foundation
extension Bool
{
static func random() -> Bool
{
return arc4random_uniform(2) == 0
}
}
View UITextField+Extensions.swift
import UIKit
extension UITextField
{
class func connectFields(fields:[UITextField]) -> Void
{
guard let last = fields.last else {
return
}
for i in 0 ..< fields.count - 1
View UIColor+Extensions.swift
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 #
You can’t perform that action at this time.