0

Upgrading my test app to swift 2.

      private func parsePeopleFromData(peopleData : NSData) -> [Person] {
            var people = [Person]()
            let jsonResult: NSDictionary = NSJSONSerialization.JSONObjectWithData(peopleData, options: NSJSONReadingOptions.MutableContainers, error : nil) as! NSDictionary
            if let rawPeople = rawPeopleDataFromJSON(jsonResult) {
                people = parsePeopleFromRaw(rawPeople)
            }
            return people
        }

It shows error on the following line, specifically on error : nil

let jsonResult: NSDictionary = NSJSONSerialization.JSONObjectWithData(peopleData, options: NSJSONReadingOptions.MutableContainers, error : nil) as! NSDictionary

Help me to fix the issue.Thanks in advance.

Sruthi
  • 69
  • 1
  • 4
  • 2
    Use "Convert to latest Swift Syntax". It converts the syntax to the new error handling. It's also described in the Swift Language Guide – vadian Oct 02 '15 at 18:25
  • After the conversion, still showing the same error. Can you post the updated code, since i am very new to swift and iOS coding. – Sruthi Oct 02 '15 at 18:53

0 Answers0