Skip to content

Instantly share code, notes, and snippets.

@KrisYu
Created March 18, 2016 01:27
Show Gist options
  • Save KrisYu/2a1e70700a5e6458e6ac to your computer and use it in GitHub Desktop.
Save KrisYu/2a1e70700a5e6458e6ac to your computer and use it in GitHub Desktop.
func printData(){
guard let path = NSBundle.mainBundle().pathForResource("contacts", ofType: "txt") else {
print("Error while reading data")
return
}
do {
let content = try String(contentsOfFile: path, encoding: NSUTF8StringEncoding)
print(content)
// return content
} catch _ as NSError{
return
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment