Day 9 of 100 days of Swift UI

Second day of covering struct.  I’m not sure if I’m tired after a late night or it just didn’t gel with me today but I found that difficult.  Feels like I need to be writing an actual app an an example so that I can see how the parts link together - it’s hard when each example isn’t linked to the previous one.

You can create your own types using structures, which can have their own properties and methods.

You can use stored properties or use computed properties to calculate values on the fly.

If you want to change a property inside a method, you must mark it as mutating.

Initializers are special methods that create structs. You get a memberwise initializer by default, but if you create your own you must give all properties a value.

Use the self constant to refer to the current instance of a struct inside a method.

The lazy keyword tells Swift to create properties only when they are first used.

You can share properties and methods across all instances of a struct using the static keyword.

Access control lets you restrict what code can use properties and methods.