write(to:atomically:)
Writes the contents of the receiver to the location specified by a given URL.
Declaration
func write(to url: URL, atomically: Bool) -> BoolReturn Value
true if the location is written successfully, otherwise false.
Discussion
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 Documentation
Deprecated
string(withCString:)init(CString:)string(withCString:length:)init(CString:length:)init(CStringNoCopy:length:freeWhenDone:)string(withContentsOfFile:)init(contentsOfFile:)string(withContentsOf:)init(contentsOfURL:)write(toFile:atomically:)getCharacters(_:)cString()lossyCString()cStringLength()getCString(_:)