Skip to content

Instantly share code, notes, and snippets.

@lizixroy
Created September 10, 2016 22:03
Show Gist options
  • Save lizixroy/e9c8ef8a0c7b3937940ce9de0d80b448 to your computer and use it in GitHub Desktop.
Save lizixroy/e9c8ef8a0c7b3937940ce9de0d80b448 to your computer and use it in GitHub Desktop.
example for an article
func uw<T>(variable: T?, file: StaticString = #file, line: UInt = #line) -> T {
continueAfterFailure = false
guard let variable = variable else {
XCTFail("unexpectedly found nil while unwrapping an Optional value", file: file, line: line)
precondition(false)
}
return variable
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment