Last active
October 16, 2019 15:17
-
-
Save andrewwoz/999d7f2acc5bde820710ed6c3213042a to your computer and use it in GitHub Desktop.
[Create file] #fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let fs = FileManager.default | |
| let content = "Hello World" | |
| let data = content.data(using: .utf8) | |
| let isCreated = fs.createFile( | |
| atPath: documents.appendingPathComponent("hello.txt").path, | |
| contents: data, attributes: nil) | |
| if isCreated { | |
| // file was created | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment