Learn iOS development the Swift way: concise articles for fast learning!

  • Classes in Swift

    A class is a data type that represents a reference type in Swift. Classes are similar to structs, but they are more powerful and flexible, and they are designed to be used as reference types rather than value types. To define a class in Swift, you use the class keyword…

  • Structs in Swift

    A struct is a data type that represents a custom value type in Swift. Structs are similar to classes, but they are simpler and more lightweight, and they are designed to be value types rather than reference types. To define a struct in Swift, you use the struct keyword followed…

  • Closures in Swift

    A closure is a block of code that you can use as a variable or pass to a function in Swift. Closures are similar to blocks in other programming languages, and they can be used for tasks such as defining a section of code to be executed at a later…

  • Arithmetic Operators in Swift

    The arithmetic operators are used to perform basic mathematical operations on numbers in Swift. These operators include the following: Here are some examples of how you could use these operators in Swift: In this code, the a and b variables are declared and initialized with the values 5 and 2,…

  • Assignment Operator in Swift

    The assignment operator (=) is used to assign a value to a variable in Swift. This is the most common and basic assignment operator in Swift. Here is an example of how you could use the assignment operator to assign a value to a variable: In this example, the score…

  • Type Annotations in Swift

    Type annotations are used to specify the type of a value or variable in Swift. Type annotations are written immediately after the variable or value name, followed by a colon (:) and the name of the type. Type annotations are optional in Swift, but they can be useful for providing…

  • Constants & Variables in Swift

    Constants and variables are used to store and manage data in your program in Swift. Constants are values that cannot be changed, while variables are values that can be changed. Constants are declared using the let keyword, followed by the name of the constant and its type. Here is an…

  • List in SwiftUI

    To create a list in SwiftUI, you can use the List view. Here is an example of how you could create a list of names using the List view: In this example, the List view is initialized with the names array and a closure that specifies what each item in…

  • Array in Swift

    In Swift, an array is a collection of values that are stored in a single ordered list. For example, you could use an array to store a list of names or a list of numbers. Here is an example of how you could create an array of strings in Swift:…