Initializer

init(contents​Of​File:​)

Returns a data object initialized by reading into it the data from the file specified by a given path.

Declaration

init?(contentsOfFile path: String)

Parameters

path

The absolute path of the file from which to read data.

Return Value

A data object initialized by reading into it the data from the file specified by path. The returned object might be different than the original receiver.

Discussion

This method is equivalent to init(contents​Of​File:​options:​) with no options.

See Also

Related Symbols

init?(contents​Of​Mapped​File:​ String)

Returns a data object initialized by reading into it the mapped file specified by a given path.

data​With​Contents​Of​File:​

Creates and returns a data object by reading every byte from the file specified by a given path.