Skip to content

Instantly share code, notes, and snippets.

@lizixroy
Created September 10, 2016 21:53
Show Gist options
  • Save lizixroy/21bdcf9219e9fd69d4ee7ca0a147c926 to your computer and use it in GitHub Desktop.
Save lizixroy/21bdcf9219e9fd69d4ee7ca0a147c926 to your computer and use it in GitHub Desktop.
examples for an article
func g<T>(array: [T], at index: Int, file: StaticString = #file, line: UInt = #line) -> T {
continueAfterFailure = false
guard index < array.count else {
XCTFail("index out of range", file: file, line: line)
precondition(false)
}
return array[index]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment