Skip to content

Instantly share code, notes, and snippets.

@fitomad fitomad/swift5_SE-0235_2.swift Secret
Created Jan 21, 2019

What would you like to do?
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
You can’t perform that action at this time.