Shizam
Shizam

Reputation: 9672

Swift: Print(object) in console not showing variable properties like Objective-C for NSObjects

I'm trying to use the console debugger (LLDB) to print out some variables but quite often the output doesn't display any of the variable's properties:

p _myObject or po _myObject (neither work)

yields

(myApp.SomeEntity) $R2 = 0x00007fa4aad2fda0 {
  myApp.SomeParentEntity = {
    CoreData.NSManagedObject = {
      ObjectiveC.NSObject = {}
    }
  }
}

ditto for other NSObjects, is there a special way you have to print out NSObjects in Swift?

Upvotes: 8

Views: 7191

Answers (2)

Claire
Claire

Reputation: 21

I had the same problem with XCode 6 and Swift project.

I finally found the explanation : On the bottom left of the Debugger console your have a Menu List with 3 options :

  • All Output,
  • Debugger Output and
  • Target Output.

To see po < variableName > you have to select All output or Debugger Output.

Upvotes: 2

user1502383
user1502383

Reputation: 325

Correct way:

po _myObject

po - print object. You can read this

Upvotes: 1

Related Questions