Initializer

init(contents​Of:​options:​)

Returns a data object initialized with the data from the location specified by a given URL.

Declaration

init(contentsOf url: URL, options readOptionsMask: NSData.ReadingOptions = []) throws

Parameters

a​URL

The URL from which to read data.

mask

A mask that specifies options for reading the data. Constant components are described in NSData.Reading​Options.

error​Ptr

If there is an error reading in the data, upon return contains an NSError object that describes the problem.

Return Value

A data object initialized with the data from the location specified by a​URL. The returned object might be different than the original receiver.

Discussion

See Also

Related Symbols

data​With​Contents​Of​URL:​options:​error:​

Creates and returns a data object containing the data from the location specified by a​URL.