I am new to Swift development. I just converted the existing working code to swift2, updating Xcode 7 with 6.
var err: NSError? let template = NSString(contentsOfFile: path!, encoding: NSUTF8StringEncoding, error: &err) as! String let iframe = template.stringByReplacingOccurrencesOfString("{{VIDEO_ID}}", withString: id, options: NSStringCompareOptions.allZeros, range: nil) if err != nil { return false }
Then, I received this error message:
Cannot invoke initializer for type 'NSString' with an argument list of type '(contentsOfFile: String, encoding: UInt, error: inout NSError?)'
Do you have any ideas? Thank you very much!
source share