Skip to content

Instantly share code, notes, and snippets.

@kinwahlai
Last active August 29, 2015 14:05
Show Gist options
  • Save kinwahlai/99328aaa1709b8dd7269 to your computer and use it in GitHub Desktop.
Save kinwahlai/99328aaa1709b8dd7269 to your computer and use it in GitHub Desktop.
Swift snippets
// slicing of array
let arr = [1,2,3,4]
arr[1..<arr.count]
arr[arr.startIndex.successor()..<arr.endIndex]
// typealias similar to typedef in C
// here we create a type for function
typealias OptionalIncrementor = Int? -> Int
// another shorthand for create dictionary
var b = [String:Int]()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment