Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created January 21, 2019 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/e24e691b1dd5d365fcb805450890dea9 to your computer and use it in GitHub Desktop.
Save fitomad/e24e691b1dd5d365fcb805450890dea9 to your computer and use it in GitHub Desktop.
let result = Result { try String(contentsOfFile: "/path/to/file") }
switch result
{
case .success(let fileContent):
print("File content:\r\n\(fileContent)")
case .failure(let reason):
print("Error: \(reason.localizedDescription)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment