title: Parsing JSON in a singleton
body: <p>Currently I'm trying to determine the best way to parse JSON in a singleton so that multiple classes can have to it. That way there is no stored data in the singleton and it stays decoupled. I've come up with a JSON parsing function but am wondering is there a better way to do it. Here is the function I'm currently using:</p>
  
  <pre><code>  func parseJSONData(_ jsonData: Data?) -&gt; [String : AnyObject]?
    {
      if let data = jsonData {
  
        do {
          let jsonDictionary = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.mutableContainers) as? [String : AnyObject]//Parses data into a dictionary
  
            // print(jsonDictionary)
  
          return jsonDictionary
  
        } catch let error as NSError {
            print("Error: \(error.localizedDescription)")
        }
      }
         return nil
    }
  </code></pre>