init(contentsOfFile:usedEncoding:)
Returns an NSString object initialized by reading data from the file at a given path and returns by reference the encoding used to interpret the characters.
Declaration
convenience init(contentsOfFile path: String, usedEncoding enc: UnsafeMutablePointer<UInt>?) throwsParameters
- path:
A path to a file.
- enc:
Upon return, if the file is read successfully, contains the encoding used to interpret the file at
path. For possible values, see Nsstringencoding.
Return Value
An NSString object initialized by reading data from the file named by path. 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.