Purpose: The workshop is designed for software developers with prior experience in languages such as Java
, Objective-C
, and Javascript
. The outcome of this workshop is to help the participants familiarize with the unique features and syntax of the Swift Programming Langauge by learning its rather unique approaches to solve design problems such as protocol-oriented, value-oriented, and functional programming. The participants are expected to be ready for the main event on Nov 17th. To make the workshop interactive and engaging, throughout the session, each topic contains a real-life applicable quiz/problem which the participants solve on their own. Shortly after, we will go through the problem together.
- Be able to identify mutable and immutable value types with
let
andvar
- Be able to understand what
type
means by referring toclass
andstruct
.
- Be able to create functions with and without arguments.
- Be able to identify the motivation behind local parameters.
Quiz: Create a function that multiples two numbers with one unnamed parameter.
- Be able to identify the benefits of using
guard
over a typicalelse-if
statement.
Quiz: Create a function that contains a guard statement which checks whether the user is providing good nutrients for plants.
- Be able to justify the usage case of using property observers by applying
willSet
anddidSet
.
Quiz: Add a property observer to
isUserLoggedIn
and prints whether the user is logged in or not upon changes.
- Be able to recognize the difference between
get
andset
by calculating the diameter of a circle. - Be able to identify benefits of using
get
only properties
Quiz: There is a stored property,
sideLength
. Create a function that calculates the area of a square.
- Be able to identify the practical usage of static methods and properties.
- Be able to distinguish between
static
andclass
when it comes to inheritance.
Quiz: Create a class that stores your contact list using
static
properties.
- Be able to recognize that Swift functions are called global closures.
- Be able to familiarize with the Swift closure syntax.
- Be able to create a closure block with various versions.
Quiz: Express the function below in a variety of ways.
- Be able to return a closure block.
- Be able to pass a closure block as a parameter.
Quiz: Enter a number and returns its squared value. The function two arguments:
Int
and(Int) -> (Int)
- Be able to execute code only after one another using closures.
- Be able to spot when to use trailing closures.
-
Be able to understand the functional paradigm.
-
Be able to recognize the difference between imperative and declarative style.
-
Be able to use closure to create a custom
filter
function. -
Quiz: Create a function that converts
[1, 2, 3, 4, 5]
to[1, 4, 9, 16, 25]
in one line.
- Be able to
[1, 2, 3, 4, 5]
to[1, 4, 9, 16, 25]
in one line.
- Be able to recognize enum can be used as a type.
- Be able to apply
Switch Statement
with enums to write safe code. - Quiz: Create a contact list along with
Switch Statement
.
- Be able to create type safe and string literal free code using
raw value
.
- Be able to apply
Associated Value
to development. - Be able to use
case let
to capture associated value. - Quiz: Create an enum called, Button with a few types and returns its name.
- Be able to recognize Swift closure as a reference type.
- Be able to use capture lists to prevent the unique behavior.
- Be able to how allocation/deallocation is managed by the
ARC
.
- Be able to differentiate between weak and unowned.
Note: Intermediate to advanced topics including the delegate pattern, lazy init with closure, @escaping, @autoclosures, access control are not covered in this workshop. However, the participants are encouraged to study on their own and ask questions via Slack before the main event.