I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
Moved to repository: https://github.com/Mailcloud/swift-serializer
This file contains hidden or 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
// | |
// SRCopyableLabel.swift | |
// | |
// Created by Stephen Radford on 08/09/2015. | |
// Copyright (c) 2015 Cocoon Development Ltd. All rights reserved. | |
// | |
import UIKit | |
class SRCopyableLabel: UILabel { |
This file contains hidden or 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
extension UIColor{ | |
convenience init (hexString:String) { | |
let cleanString = hexString.stringByTrimmingCharactersInSet(NSCharacterSet.alphanumericCharacterSet().invertedSet) | |
var rgbValue = UInt32() | |
NSScanner(string: cleanString).scanHexInt(&rgbValue) | |
let a,r,g,b:UInt32 | |
switch cleanString.characters.count{ | |
case 3: // RGB (12-bit) |