Instance Method


Writes the contents of the array to the location specified by a given URL.


func write(to url: URL, atomically: Bool) -> Bool



The location at which to write the array.


If true, the array is written to an auxiliary location, and then the auxiliary location is renamed to aURL. If false, the array is written directly to aURL. The true option guarantees that aURL, if it exists at all, won’t be corrupted even if the system should crash during writing.

Return Value

true if the location is written successfully, otherwise false.


If the array’s contents are all property list objects (NSString, NSData, NSArray, or NSDictionary objects), the location written by this method can be used to initialize a new array with the class method arrayWithContentsOfURL: or the instance method init(contentsOf:).

See Also

Storing Arrays

func write(toFile: String, atomically: Bool) -> Bool

Writes the contents of the array to a file at a given path.