-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Mastering macOS Programming
By :

We started with UserDefaults
because you are likely to have used them before. Most tutorials that deal with data storage start with text. This is true for most platforms; macOS is no exception, and this section will bring us up to speed with the ease with which we can store text files.
Foundation String
objects provide methods for storing and loading text data. The text can be stored in a number of common formats, meaning that we can store text files that can be read by other programs, and of course, reading in different formats allows us to load text files that have been created outside our app. Once we have the path of the file to be saved, storing or loading is just a couple of lines of code.
We'll start with a text file IO extension to CustomFileManager
.
Keeping the code tidy, we'll create a new extension to the CustomFileManager
, to which we'll directly add a helper function that will return a URL
at which we will...