so before downloaded recent update, following code worked me:
var g_home_url = string.stringwithcontentsofurl(nsurl(string: url_string), encoding: nsutf8stringencoding, error: nil) // gives me error: "string.type not have member names stringwithcontentsofurl" i confused. proper way acieve following objective-c method in swift?
nsstring * g_home_url = [[nsstring alloc] initwithcontentsofurl:[nsurl urlwithstring:home_url] encoding:nsutf8stringencoding error:nil];
use -initwithcontentsofurl:encoding:error: instance method instead of +stringwithcontentsofurl:encoding:error: class convenience initializer.
var g_home_url = string(contentsofurl: nsurl(string: url_string)!, encoding: nsutf8stringencoding, error: nil) i have no idea if class convenience initializers unsupported in swift, make sense shorthands alloc-init boilerplate, doesn't exist in swift.
Comments
Post a Comment