Learn how to edit code in a playground. Remove syntax errors. Add code for executing the class. Run the playground. Use a quick look and step speed to display the results of the playground.
- [Instructor] You've created a class in playgrounds.…If you haven't yet, you can download a copy…from the examples folder.…Now you want to run it.…But before we do, there's a few things I want to bring up…about errors.…First of all, I'm not happy with that identifier price.…For arrays, I like to have them in the plural…so I can identify collection types easily when reading code.…Tap right after the word price…or on right on the word price and change it to prices.…When you do, you'll see a red dot appear.…That's a syntax error.…Tap the error, and you get a pop up for the error.…
In this case, playgrounds gives you a suggestion…on how to fix the error that price in the print statement…is wrong and really should be prices.…So go ahead and hit fix, cause that's correct.…And it fixes the prices.…I also have another error here,…which I'm just going to quickly fix…and that's at the pizza list…is a small p not a capital P.…Classes should have a capital P.…So, I'll go ahead and hit shift,…P I Z Z A, shift list.…
So I've gone ahead and fixed that one.…
- Comparing iPad and Xcode playgrounds
- Creating and testing Swift classes and code in iPad and Xcode playgrounds
- Prototyping code
- Debugging and testing with Quick Look live views
- Using markup to interactively document code and create educational lessons
- Compiling code into playground books
Skill Level Intermediate
1. Introducing Playgrounds
2. Xcode Playgrounds
3. iPad Playgrounds
4. Markup and Playgrounds
5. Playground Books
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.