Instance Method


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


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

Return Value

true if the location is written successfully, otherwise false.


If atomically is true, the receiver is written to an auxiliary location, and then the auxiliary location is renamed to aURL. If atomically is false, the receiver 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.

The atomically parameter is ignored if aURL is not of a type that can be accessed atomically.

See Also

Related Symbols

func write(to: URL, atomically: Bool, encoding: UInt)

Writes the contents of the receiver to the URL specified by url using the specified encoding.