File Management

Overview

Reading the Data

Get Document Directory

func getDocumentsDirectory() -> URL {
    // find all possible documents directories for this user
    let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)

    // just send back the first one, which ought to be the only one
    return paths[0]
}

Writing the Data

There are two methods in writing the data

1- Saving in parts

2- Saving in bulk (Atomic writing)

Swift 's native Encoding is UTF8

Sources

Videos

Articles / Documents

See also

Last updated