[Swift 1] Day 3 - Xcode Debugging and Playgrounds


Day 3 Topics

  • Learn to debug code
  • Walk through code line by line
  • Understand breakpoints
  • Using the code Playgrounds


  • What is confusing?
  • Where did you get stuck?
  • What can I explain better?

Tomorrow we should be starting the programming concept lessons. I’ll explain some of the code you’ve been working with and what it means.



Just want to share a little Playground tip.

I find myself using the Playground a lot now.
Instead of creating many different Playground files, I created a “main one” and dragged / dropped it to the dock.
Now I can access the Playground anytime:

Simple and effective, it can save some time. :wink:


The confusing part of Playground for me was the sizing part.

Say you start with a larger picture than the size of the iPhone/iPad you are trying to fit it in. How do you resize it within Playground?

I looked up a couple of sources via google (http://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage) but I can not tell what exactly the code means and where to input it to work for my project. And the other thing is, why isn’t it simpler than these long strings of code just to resize an image?



I am having an issue

Im not sure what is going on, it is running correctly, but now all of my UI elements are showing up white. Its even doing it in when building a iOS app now

Any ideas on what is wrong??


It is also not allowing me to use the . operator


Trying to see the pictures:


Could you share the code? I mean the entire project, so I could try running it.
You could use GitHub or zip the project it and send a link to the file.

I’m not home right now, but I can try later.


@Fernando Sorry about the pictures, i tried rotating them but they decided not to listen to me lol

I am not able to send the full project right now until later this evening. I cant connect to the internet on my personal laptop while at work, so I use my work computer for the video and forum

I will as soon as I can. But i will say everything compiles and runs fine. I have no issues with the code and i havent change any of it. I think its something with my settings, when i did the playground assignment, thats when i noticed it because the var eyeColor = UIColor.blueColor() did not highlight the normal syntax color. The code compiled with no errors but when i type the “.” i didnt get a list of methods to choose from.

Hope im making sense.


Also if i hold option and click on UIKit, nothing pops up, it says “no quick help”


@PaulSolt @Fernando Ok so I have found, after hours of searching, that there are bugs in Xcode when it comes to text editor coloring:


This worked for me…for now

  1. Xcode preferences, select Locations tab

  2. Click on the tiny arrow after the Derived Data path (opens finder for you)

  3. Go into the Derivied Data folder (double click it)

  4. Delete all files within it

  5. Restart XCode


Damn… I was thinking of using Xcode version 6.1, but now with your findings… I’m not so sure. :smiley: Thanks for sharing.