Agung Laksana Agung Laksana - 3 years ago 161
iOS Question

why my print result of from one swift file does not appear in xcode debug area

xcode debug area


i am a new beginner in iOS development. i am trying to learn someone code to build an app.

here is the screenshot of my problem :

i am trying to print("helloo") and print("your requestID is : ") but it doesnt appear in my debug area, that code is written in my ViewController.swift file

the debug area just print out the networking result from VenuesTableViewController.swift file (from another swift file)

what went wrong in here ? thanks in advance :)

Answer Source

Based on your code, it's very strange that your printing "helloo" doesn't appear on your debug area since it is declared on the viewDidLoad of your ViewController. Did you really use this ViewController ?

The second print "Your request id..." can or not be print based on your previous guard statements : guard let dictionnarayJSON...guard let meta...guard let requestID. A guard statement allows you to control the flow of your code. If what you test is correct it can continue to proceed your code. If not you put return so the flow of your code is stopped.

So, if one of your 3 guard statements fails, you can't reach your printing statement print(Your requet id...)

I recommend you to see Apple documentation : Control Flow

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download