Select Page

Conditionals

This tutorial has been updated for Xcode 8 and Swift 3. Control flow is an essential aspect of any programming language. In this and the next lesson, we discuss loops and conditionals. We start with conditionals.

What Is a LazyMapCollection in Swift

In yesterday’s lesson of 30 Days of Swift, we talked about collection types. At first glance, the collection types defined by the Swift standard library look similar to the ones you find in other programming languages. But if you dig a little deeper, you start to see the differences.

Collection Types

This tutorial has been updated for Xcode 8 and Swift 3. In the previous lessons, we explored some of the common types defined by the Swift standard library. Today, we continue that exploration by taking a close look at collection types. The Swift standard library defines three collection types:

Tuples and Optionals

This tutorial has been updated for Xcode 8 and Swift 3. Tuples Now that you know the basics of variables, constants, and types, it’s time to learn about another powerful concept of Swift, tuples. A tuple groups multiple values into a single compound value. The following example illustrates this concept.

Variables, Constants, and Types

This tutorial has been updated for Xcode 8 and Swift 3. In the previous lesson, I briefly talked about variables and constants. You learned that the var keyword declares a variable and the let keyword is used to declare a constant. Both variables and constants store values that can be referenced by a name.

Playgrounds

This tutorial has been updated for Xcode 8 and Swift 3. Swift is an easy language to get started with. The syntax is easy to understand and reminiscent of other popular programming languages you may already be familiar with. In 30 Days of Swift, you learn the fundamentals of the Swift programming language.

Enumerations

Enumerations There is one building block I haven’t mentioned yet, enumerations, or enums for short. Like structs, enums are value types. At first glance, structs and enums look very much alike. Enums can have methods and initializers. And while they can have computed properties, they cannot define properties.

What Is the Difference Between Public and Open in Swift 3

Swift 3 brought many new features and enhancements to the language. It also introduced several changes to access control by adding two new access levels, open and fileprivate. I already discussed the difference between private and fileprivate earlier this year. In this tutorial, I focus on the difference between public and open.