This file contains 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
#!/bin/bash | |
# update_build_number.sh | |
# Usage: `update_build_number.sh [branch]` | |
# Run this script after the 'Copy Bundle Resources' build phase | |
# Ref: http://tgoode.com/2014/06/05/sensible-way-increment-bundle-version-cfbundleversion-xcode/ | |
branch=${1:-'develop'} | |
buildNumber=$(expr $(git rev-list $branch --count) - $(git rev-list HEAD..$branch --count)) | |
echo "Updating build number to $buildNumber using branch '$branch'." |
This file contains 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 | |
let string = "e5cfb500" | |
for var index = string.startIndex; index < string.endIndex; index = index.advancedBy(2) { | |
let rangeOfCharacterPair = Range<String.Index>(index..<index.advancedBy(2)) | |
let characterPair = string.substringWithRange(rangeOfCharacterPair) | |
print(characterPair) | |
} |
This file contains 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 | |
extension UIViewController { | |
class func fromStoryboard(name: String, identifier: String? = .None, bundle: NSBundle? = .None) -> Self? { | |
return fromStoryboardHelper(self, name: name, identifier: identifier, bundle: bundle) | |
} | |
private class func fromStoryboardHelper<T: UIViewController>(type: T.Type, name: String, identifier: String?, bundle: NSBundle?) -> T? { | |
if let identifier = identifier { |
This file contains 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
xcrun llvm-cov report -use-color=true -instr-profile \ | |
./Build/Intermediates/CodeCoverage/Coverage.profdata \ | |
./Build/Intermediates/CodeCoverage/MyApp/Products/Debug-iphonesimulator/MyApp.app/MyApp |
This file contains 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 NSObject { | |
func typeNameWithOutModuleName() -> String { | |
var typeNameHeirarchy = NSStringFromClass(self.dynamicType).componentsSeparatedByString(".") | |
typeNameHeirarchy.removeFirst() | |
return typeNameHeirarchy.joinWithSeparator(".") | |
} | |
} |
This file contains 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 | |
var strings = ["one", "two", "three", "four"] | |
extension Array { | |
func mapFilter<U>(transform: (T) -> U?) -> [U] { | |
var o = [U]() | |
for e in self { |
This file contains 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 | |
class Thing { | |
func doStuff(stuff:String) { | |
} | |
func doStuffWithAThing(stuff:String, athing:String) { | |
} | |
func doStuffWithTwoThings(stuff:String, thingOne:String, thingTwo:String) { |
This file contains 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 Cocoa | |
class Thing:NSObject { | |
func a() { | |
println("a") | |
} | |
} | |
extension Thing { | |
// func a() { |
This file contains 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 | |
class foo { | |
var bar:String! | |
func print() { | |
println("some stuff and \(self.bar)") | |
} | |
This file contains 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 class Thing: NSObject { | |
public enum State { | |
case yes, no, maybe | |
} | |
public var state:State | |
internal init() { |
NewerOlder