Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!!

like image 656
RanLearns Avatar asked Aug 22 '16 21:08

RanLearns


1 Answers

According to the Swift 3 Migration Guide,

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

like image 198
J. Cocoe Avatar answered Sep 20 '22 22:09

J. Cocoe