Skip to content

Commit

Permalink
call can throw but is not marked with try
Browse files Browse the repository at this point in the history
Hello,
I See JSON(data: data) has throws exception, so add 'try' in front, the error "call can throw but is not marked with try" can fixed.

public init(data: Data, options opt: JSONSerialization.ReadingOptions = []) throws {
}
  • Loading branch information
JackSteven authored Apr 20, 2017
1 parent f9afe96 commit acbe241
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if let file = Bundle.main.path(forResource: "SwiftyJSONTests", ofType: "json") {
do {
let data = try Data(contentsOf: URL(fileURLWithPath: file))
let json = JSON(data: data)
let json = try JSON(data: data)
viewController.json = json
} catch {
viewController.json = JSON.null
Expand Down

0 comments on commit acbe241

Please sign in to comment.