RanLearns
RanLearns

Reputation: 4176

String(contentsOfURL:) in Swift 3

This code from before:

if let resultOfURL = try? String(contentsOfURL:myURL!, encoding: String.Encoding.utf8) {

Is now throwing this error:

'init' has been renamed to 'init(describing:)'

Any help? Thanks so much!!

Upvotes: 5

Views: 5194

Answers (1)

J. Cocoe
J. Cocoe

Reputation: 941

According to the Swift 3 Migration Guide,

Users may need to manually migrate calls to String(contentsOfURL:usedEncoding:) to String(contentsOf:usedEncoding:)

Upvotes: 9

Related Questions