rm -rf /Library/Developer/ (Or, you can rename it. It's probably safer to rename it.)
- Xcode 6.4: icons in Simulator were garbled
| static func getPrimes(to n: Int) -> [Int] { | |
| let xmody = (1...n) | |
| .map { x in (1...n).map { y in x % y } } | |
| let primes = xmody | |
| .map { mods in | |
| mods.enumerate() | |
| .filter { y, mod in mod == 0 } | |
| .map { y, mod in y + 1 } // divisors for x | |
| } |
| /// # Things go wrong in Swift 2.1 | |
| /// ## A protocol overriding/giving default implementation to its parent's methods | |
| /// If you have a class conform to this protocol and try compile, you will get segmentation fault 11. | |
| protocol SingleSectionTableViewDataSource: UITableViewDataSource { | |
| typealias ItemType | |
| var items: [ItemType] { get set } | |
| } |
For faster connection speed and more flexibility.
/Applications/Xcode.app/Contents/MacOS/Xcode| #!/usr/bin/env xcrun swift | |
| // Usage: path/to/TimeTracking.swift | |
| // Go to bottom to see how it's used. | |
| // The MIT License (MIT) | |
| // Copyright (c) 2015 Nicholas T. | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy |
| #!/usr/bin/env python2 | |
| # Remove all merged branches, except ignored as specified in IGNORE_BRANCHES | |
| import subprocess | |
| IGNORE_BRANCHES = ['master', 'develop'] | |
| def main(): | |
| checkout_branch('master') | |
| merged_branches_except_ignored = filter_branches_with_ignores( |
| import UIKit | |
| import SnapKit | |
| class SomeViewController: UIViewController { | |
| var addButton = UIButton() | |
| var helloWorldLabel = UILabel() | |
| override func viewDidLoad() { | |
| let superView = view | |
| let views = [ |
| // | |
| // NSDate+timeAgo.swift | |
| // | |
| // | |
| // Created by Nicholas Tian on 19/08/2015. | |
| // Copyright (c) 2015 nickTD. All rights reserved. | |
| // | |
| import Foundation |
| for fontFamily in UIFont.familyNames() { | |
| println("family: \(fontFamily)") | |
| for font in UIFont.fontNamesForFamilyName(fontFamily as! String) { | |
| println("font: \(font)") | |
| } | |
| } |