write(toFile:options:)
Writes the data object’s bytes to the file specified by a given path.
Declaration
func write(toFile path: String, options writeOptionsMask: NSData.WritingOptions = []) throwsParameters
- path:
The location to which to write the receiver’s bytes.
- writeOptionsMask:
A mask that specifies options for writing the data. Constant components are described in Writingoptions.
Discussion
This method may not be appropriate when writing to publicly accessible files. To securely write data to a public location, use FileHandle instead. For more information, see Securing File Operations in Secure Coding Guide.