Skip to content

Instantly share code, notes, and snippets.

@M-Medhat
Created February 2, 2015 09:37
Show Gist options
  • Save M-Medhat/c116e89601cb97f667ed to your computer and use it in GitHub Desktop.
Save M-Medhat/c116e89601cb97f667ed to your computer and use it in GitHub Desktop.
Using resources in a Swift Playground
var error:NSError? = nil
if let mdStr = String(contentsOfFile: "/path/to/file/test.txt", encoding: NSUTF8StringEncoding, error: &error) {
print("File Opened!")
} else {
if(error != nil) {
print(error?.description)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment