Summary and Notes from Lecture 2, Developing iOS 11 Apps with Swift by Stanford (cs193p)

20180102_011958

MVC Communication Methods

Views use:

  • Outlets – target action
  • Delegates – should, will, did
  • Data Source – data at, count

Models use:

  • Notification & KVO (Key Value Observing)

Additional Notes

The Card struct is UI independent. It’s tempting to allow the Card to also store the emoji symbol. However the emoji symbol is a view element. Therefore it should not be allowed in Card.

Classes get free initializers as long as all their instance variables are initialized.
Struct also get free initializer allowing all its instance variables to be initialized.

Lazy vars cannot have property observers (didSet).

State of the App after Implementing the Code from Lecture 2

Source code

The source code of the app Concentration is available here:
https://github.com/sanjibahmad/Concentration

Summary of Lecture 1, Developing iOS 11 Apps with Swift by Stanford (cs193p)

Developing iOS11 Apps with Swfit - Lecture 1 Summary

What’s New

After completing the 1st lecture, here is what I found new from the previous courses I took a few years ago.

  • Uses Swift 4, Xcode 9
  • Rename (refactor) with cmd + click on variable name
  • Fuzzy match on intellisense (was available form Xcode 8)
  • Back to developing card game  (the previous few years focused on developing calculator)
  • Outlet collections

Notes

  • Property observers are used to keep the UI in sync with instance variables. For example: var flipCount = 0 { didSet { flipCountLabel.text = “Flips: \(flipCount)” } }

The following video shows the state of the app Concentration after completing lecture 1.

 

The course Developing iOS 11 Apps with Swift by Stanford (cs193p) is available for free from https://itunes.apple.com/us/course/developing-ios-11-apps-with-swift/id1309275316

Gesture in Oil on Manila Paper

Practicing gestures in oil is a great way to gain more experience in handling paint. Here is a quick study of a ballet dancer shown in 2 phases:

Lizard Brain, False Reality and the Death of Dreams

The lizard brain can seriously inhibit intelligent decision-making. It’s not that the decision will even sound wrong, under the circumstances it might well be the right thing to do. But the threat might only be perceived and the danger not be real. It could be just a false alarm that triggers the sense of danger.

The truth is that the real danger is willing to sacrifice dreams for “perceived” reality. Perceived reality is often scary. And fear is the real dream killer.

How to tell? We feel bad when we don’t get to do the thing we really want to do. We can fool ourselves in to thinking that it’s not really that bad. But the test is simple. How do you feel? Are you doing the thing that brings you the highest joy? Are you acting on your highest passion?