Skip to content

Instantly share code, notes, and snippets.

@cnpdev
Forked from 3lvis/prettyprint.swift
Created November 5, 2019 16:13
Show Gist options
  • Save cnpdev/1e310518c1e97f53e284f12c736e23c3 to your computer and use it in GitHub Desktop.
Save cnpdev/1e310518c1e97f53e284f12c736e23c3 to your computer and use it in GitHub Desktop.

Revisions

  1. @3lvis 3lvis revised this gist May 4, 2019. No changes.
  2. @3lvis 3lvis revised this gist Jan 5, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion prettyprint.swift
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    print(String(data: try! JSONSerialization.data(withJSONObject: dict, options: .prettyPrinted), encoding: .utf8))
    print(String(data: try! JSONSerialization.data(withJSONObject: dict, options: .prettyPrinted), encoding: .utf8)!)
  3. @3lvis 3lvis revised this gist Jan 5, 2018. 2 changed files with 1 addition and 3 deletions.
    3 changes: 0 additions & 3 deletions prettyprint
    Original file line number Diff line number Diff line change
    @@ -1,3 +0,0 @@
    let data = try! NSJSONSerialization.dataWithJSONObject(JSON!, options: .PrettyPrinted)
    let string = NSString(data: data, encoding: NSUTF8StringEncoding)!
    print(string)
    1 change: 1 addition & 0 deletions prettyprint.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    print(String(data: try! JSONSerialization.data(withJSONObject: dict, options: .prettyPrinted), encoding: .utf8))
  4. @3lvis 3lvis created this gist May 14, 2016.
    3 changes: 3 additions & 0 deletions prettyprint
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    let data = try! NSJSONSerialization.dataWithJSONObject(JSON!, options: .PrettyPrinted)
    let string = NSString(data: data, encoding: NSUTF8StringEncoding)!
    print(string)