Can I get an subclass's property from a function call that returns said subclass?

While debugging I would like to get a specific subclass's property. So far I can do this:

if let myPeg = getTargetSlot(node: node, location touchLocation){
          print (myPeg.index)
            }

Is it possible to write it in one line? Something like this?

print ("\(getTargetSlot(node: node, location touchLocation).index")

Because if there is a way, I cannot figure out the syntax.

Thanks

Answered by robnotyou in 684434022

Are you missing a bracket?
Try:

print("\(getTargetSlot(node: node, location touchLocation).index)")
Accepted Answer

Are you missing a bracket?
Try:

print("\(getTargetSlot(node: node, location touchLocation).index)")
Can I get an subclass's property from a function call that returns said subclass?
 
 
Q