Code Snippet: Read File

From Coder Merlin
Revision as of 13:39, 6 December 2018 by Chukwuemeka-tinashe (talk | contribs) (Created page with "== Read the contents of a file into a string == <syntaxhighlight lang="swift"> let contents = try! String(contentsOfFile: "hello.txt")...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Read the contents of a file into a string[edit]

let contents = try! String(contentsOfFile: "hello.txt")