Agenda
- Discussion: Don’t Repeat Yourself
- How to keep your code tidy.
- Capitalization conventions when authoring Swift code.
- Vocabulary review.
- Reviewing various solutions to the exercise from yesterday’s class.
TIP
Here is code that exemplifies the idea of embedding one structure inside another, and here is a screenshot comparing that code to the cards themselves.
- Portfolio: Sharing Code
- Share code, not screenshots of code.
- Please continue to use screenshots to show the results of code being run.
- Portfolio: Comments on Posts
- Do not mark comments as resolved in Notion so that the record of our conversation is preserved and easy to see at a glance.
- Concept: Computed Properties
- Structures can do more than just store values - they can calculate values as well.
TIP
Here is the code we developed and discussed in class, and here is a screenshot showing the results when the code is run.
- Exercise: Describing 2D and 3D Figures
- You have been randomly assigned a 2D or 3D figure to work with.
- Create a new Xcode playground named Computed Properties Exercise.
- Write a structure that models the figure you have been assigned.
- The structure should use stored properties and computed properties.
- Make several instances of the structure and test your work.
Things to do before our next class
- Complete the exercise on structures as described above, then write about what you learned in a portfolio entry on Notion.