Last active
August 29, 2015 14:05
-
-
Save kinwahlai/99328aaa1709b8dd7269 to your computer and use it in GitHub Desktop.
Swift snippets
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
// 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