InitializerFoundationEssentials
init(contentsOf:options:)
iOS 8.0+
iPadOS 8.0+
Mac Catalyst 8.0+
macOS 10.10+
tvOS 9.0+
watchOS 2.0+
Creates data by reading from the specified URL.
init(contentsOf url: URL, options: Data.ReadingOptions = []) throws
Parameters
urlThe
URLto read.optionsOptions for the read operation. Default value is
[].
Discussion
Throws
An error in the Cocoa domain, if url cannot be read.