Author: admin

  • Working with Array and Dictionary Collections in Swift

    Arrays and dictionaries in Swift are objects that contain collections of other objects. This chapter will cover some of the basics of working with arrays and dictionaries in Swift. Mutable and Immutable Collections Collections in Swift come in mutable and immutable forms. The contents of immutable collection instances cannot be changed after the object has…

  • An Introduction to Swift Subclassing and Extensions

    In The Basics of Swift Object-Oriented Programming, we covered the basic concepts of object-oriented programming and worked through an example of creating and working with a new class using Swift. In that example, our new class was not derived from any base class and, as such, did not inherit any traits from a parent or…

  • The Basics of Swift Object-Oriented Programming

    Swift provides extensive support for developing object-oriented applications. The subject area of object-oriented programming is, however, large. It is not an exaggeration to state that entire books have been dedicated to the subject. As such, a detailed overview of object-oriented software development is beyond the scope of this book. Instead, we will introduce the basic…

  • Swift Functions, Methods, and Closures

    Swift functions, methods, and closures are a vital part of writing well-structured and efficient code and provide a way to organize programs while avoiding code repetition. This chapter will look at how functions, methods, and closures are declared and used within Swift. What is a Function? A function is a named block of code that…

  • The Swift Switch Statement

    In Swift Control Flow, we looked at controlling program execution flow using the if and else statements. While these statement constructs work well for testing a limited number of conditions, they quickly become unwieldy when dealing with larger numbers of possible conditions. To simplify such situations, Swift has inherited the switch statement from the C…

  • Swift Control Flow

    Regardless of the programming language used, application development is largely an exercise in applying logic, and much of the art of programming involves writing code that makes decisions based on one or more criteria. Such decisions define which code gets executed, how many times it is executed and, conversely, which code gets by-passed when the…

  • Swift Operators and Expressions

    So far we have looked at using variables and constants in Swift and also described the different data types. Being able to create variables, however, is only part of the story. The next step is to learn how to use these variables and constants in Swift code. The primary method for working with data is…

  • Swift Data Types, Constants and Variables

    If you are new to the Swift programming language then the next few chapters are recommended reading. Although SwiftUI makes the development of apps easier, it will still be necessary to learn Swift programming both to understand SwiftUI and develop fully functional apps. If, on the other hand, you are familiar with the Swift programming…

  • An Introduction to Xcode 15 Playgrounds

    Before introducing the Swift programming language in the following chapters, it is first worth learning about a feature of Xcode known as Playgrounds. This is a feature of Xcode designed to make learning Swift and experimenting with the iOS SDK much easier. The concepts covered in this chapter can be put to use when experimenting…

  • Installing Xcode 15 and the iOS 17 SDK

    iOS apps are developed using the iOS SDK and Apple’s Xcode development environment. Xcode is an integrated development environment (IDE) within which you will code, compile, test and debug your iOS applications. All of the examples in this book are based on Xcode version 15 and use features unavailable in earlier Xcode versions. This chapter…