Skip to content

Instantly share code, notes, and snippets.

@chenr2
Last active August 29, 2015 14:25
Show Gist options
  • Save chenr2/da645780de2b28bfc8eb to your computer and use it in GitHub Desktop.
Save chenr2/da645780de2b28bfc8eb to your computer and use it in GitHub Desktop.
Swift: Caveman debugging with println

Caveman debugging with println

Here's a handy snippet when inspecting the network response.

println("request:: \(request)")
println("response:: \(response)")
println("data:: \(data)") 
println("error:: \(error)")

If you want to print out an object you created, implement the description. You do need to subclass NSObject and override its description property.

class Thing:NSObject {
    var id = 0
    override var description:String {
        return "My Thing is id:: \(id)"
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment