Skip to content
Swift is Fun

Swift topics

Published topics in Swift Basics and Advanced Swift. Each one links to its lecture.

Swift Basics

  • Properties

    A property is a named place in memory that stores a value.

  • Basic data types

    Specifying the type explicitly means writing the data type by hand.

  • Operators

    Operators are special symbols or keywords that perform operations on values (operands).

  • Working with strings

    Sometimes a developer needs to leave a note in the code.

  • Value and range checking

    A range is a span of numbers in sequence from one value to another.

  • Conditional statements

    When developing applications, very often there is a need to execute certain code depending on conditions.

  • Ternary operator

    Unlike the if construct, the ternary operator has only two possible branches: for true and for false.

  • switch statement

    When we have many similar checks, it is more convenient to use the switch construction.

  • Scope

    When you work in Xcode, all code you write outside of curly braces is in global scope.

  • Arrays

    Array is a collection type that is a set of non-unique values of the same type, each of which has its own index.

  • Optionals

    An optional type is a special data type that can contain either a value or no value (nil).

  • Type conversion

    Sometimes a string needs to be converted to a number, for example to perform math.

  • Dictionaries

    The keys in the dictionary must be unique and of the same type, and the values can be repeated, but must also have the same common type.

  • Tuples

    Tuples can be thought of as a way to combine multiple values into a single entity.

  • Sets

    Set is a collection of unique elements that do not have a specific order.

  • Loops

    A loop is a construct that allows you to repeat the same block of code several times.

  • Enumerations

    An enumeration is a data type that defines a set of constants, where each value is one of possible alternatives.

  • Functions

    Everything you see in any application is the result of functions.

  • The guard statement

    The guard keyword marks the beginning of the statement and is followed by a condition.

  • Computed Properties

    A computed property in Swift doesn't store its own value — the value is calculated every time the property is accessed.

  • Function Types

    In Swift, every value has a specific type, and functions are no exception.

  • Closures

    A closure is a block of code that you can store in a constant or variable, pass to a function, and run later.

Advanced Swift

  • Structures

    Imagine we are developing an app for a veterinary clinic that treats only dogs.

  • Methods and value types

    Dot syntax is used to access a property: write the instance name followed by a dot and the property name.

  • Classes

    Classes are similar to structures in many ways: they can also contain properties, initializers, and methods.

  • Convenience initializers

    One initializer can also call another with self.init and pass it the work of initializing the instance.

  • Controlling access to properties and methods

    Until now, every property and method of the types we created was available to the rest of the code.

  • Inheritance

    Imagine that we are creating two interface elements: a button and a text label.