init(contentsOfFile:encoding:)
Returns an NSString object initialized by reading data from the file at a given path using a given encoding.
Declaration
convenience init(contentsOfFile path: String, encoding enc: UInt) throwsParameters
- path:
A path to a file.
- enc:
The encoding of the file at
path. For possible values, see Nsstringencoding.
Return Value
An NSString object initialized by reading data from the file named by path using the encoding, enc. The returned object may be different from the original receiver. If the file can’t be opened or there is an encoding error, returns nil.