Category: Uncategorized

  • When working on an application in its infancy… I’m talking like MVP… security is not usually the first concern.

    ·

  • Structs, part 2 How to limit access to internal data using access control In order to have a private variable/const inside of a struct, just use the private keyword. The point of the private keyword is to limit access to the variable inside of struct such that it can not be written to or read…

    ·

  • Structs, part 1 How to create your own structs A struct is a custom, complex data type complete with their own variables and functions. A struct when named is capitalized. All data types are capitalized. We can have values that change based on parameters. But if we create an Employee with a let, Swift will…

    ·

  • This one was all about closures How to create and use closures Passing function by reference Assign function directly to a variable How to write a closure. Note – we don’t use parameter names when calling a closure Scored 12/12 on Creating basic closuresScored 7/12 on Accepting Parameters in a closureScored 10/12 on Returning Values…

    ·

  • Functions 2 How to provide default values for parameters Say we want to provide a default value for a parameter. Ex: We can do: Or: Now these are legal: Scored 9/12 on default parameters How to handle errors in functions studysubject We need to handle errors gracefully or our code will crash. Error handling in…

    ·