String (contentsOfURL :) in Swift 3

This code is from:

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

Throws this error:

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

Any help? Many thanks!

+4
source share
1 answer

According to the Swift 3 Migration Guide ,

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

+9
source

Source: https://habr.com/ru/post/1652113/


All Articles