Swift’s Foundation framework provides the FileManager class, which has methods to manage the file system.
FileManager
Swift makes creating temporary files pretty easy, using the FileManager class.
To read text from a file in Swift, use String class’ convenience methods.
String
Swift makes reading command line arguments super straightforward.
Swift’s standard library includes all the tools needed to write text files.
In Swift, writing to standard error can be done using the FileHandle class for direct stderr access.
FileHandle