SPC q q
- quitSPC w /
- split window verticallySPC w
- - split window horizontallySPC 1
- switch to window 1SPC 2
- switch to window 2SPC w c
- delete current windowSPC TAB
- switch to previous bufferSPC b b
- switch buffers
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
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 UIView { | |
var allSubViews : [UIView] { | |
var array = [self.subviews].flatMap {$0} | |
array.forEach { array.append(contentsOf: $0.allSubViews) } | |
return array | |
} | |
} |
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
You can use a flag and store it via NSUserDefaults. | |
extension UserDefaults { | |
private static let didLaunchAppOnceKey = "didLaunchAppOnce" | |
var didLaunchAppOnce: Bool { | |
get { return bool(forKey: UserDefaults.didLaunchAppOnceKey) } | |
set { set(newValue, forKey: UserDefaults.didLaunchAppOnceKey) } | |
} |
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
import Foundation | |
import UIKit | |
import PlaygroundSupport | |
let someView = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 200)) | |
someView.backgroundColor = UIColor.red | |
PlaygroundPage.current.liveView = someView |
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
import Foundation | |
public extension String { | |
public func rangeFromNSRange(aRange: NSRange) -> Range<String.Index> { | |
let s = advance(self.startIndex, aRange.location) | |
let e = advance(self.startIndex, aRange.location + aRange.length) | |
return s..<e | |
} | |
public var ns : NSString {return self as NSString} | |
public subscript (aRange: NSRange) -> String? { |
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
//in viewDidLoad | |
enum Suit { | |
case Clubs, Diamonds, Hearts, Spades | |
} | |
enum Rank { | |
case Jack, Queen, King, Ace | |
case Num(Int) | |
} |
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
enum Suit { | |
case Clubs, Diamonds, Hearts, Spades | |
} | |
enum Rank { | |
case Jack, Queen, King, Ace | |
case Num(Int) | |
} | |
struct Card { |