...

/

Working with Files in Swift using FileManager

Working with Files in Swift using FileManager

Find out how to read and write to files from within Swift code; also learn about renaming, moving, copying, comparing, and deleting files.

In the previous lesson, we looked at the FileManager, FileHandle and Data Foundation Framework classes and discussed how the FileManager class, in particular, enables us to work with directories when writing Swift code. We also spent some time covering the file system structure used by Swift. In particular, we looked at the temporary and Documents directories and how the location of those directories can be identified from within Swift code.

In this lesson, we’re moving on from working with directories to covering the details of working with files within Swift.

Obtaining a FileManager instance reference

Before proceeding, we first need to recap the steps necessary to obtain a reference to a FileManager instance. As discussed in the previous lesson, the FileManager class contains a property named default ...