Agung
Agung

Reputation: 13803

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

xcode debug area

enter image description here

hi,

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 : https://i.sstatic.net/4QX5P.png

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 :)

Upvotes: 0

Views: 335

Answers (1)

Arrabidas92
Arrabidas92

Reputation: 1153

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

Upvotes: 1

Related Questions