Skip to content

Instantly share code, notes, and snippets.

@execjosh
Created March 6, 2018 06:20
Show Gist options
  • Save execjosh/f9efb7a66f70ed8b4d343a476a610534 to your computer and use it in GitHub Desktop.
Save execjosh/f9efb7a66f70ed8b4d343a476a610534 to your computer and use it in GitHub Desktop.
Compatiblility shim for updating to SwiftyJSON v4.0.0
import SwiftyJSON
public extension JSON {
// Compatiblility shim for updating to SwiftyJSON v4.0.0
// See changes introduced by: https://github.com/SwiftyJSON/SwiftyJSON/pull/833
init(data: Data) {
do {
try self.init(data: data, options: [])
} catch {
self.init(jsonObject: NSNull())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment