Swift Tuple Type
Learn how to use the Swift tuple data type to store multiple values within a single entity.
We'll cover the following...
We'll cover the following...
Introducing the Swift tuple
The tuple
is perhaps one of the simplest but, most powerful features of the Swift programming language. Quite simple, a tuple is, quite simply, a way to temporarily group together multiple values into a single entity. The items stored in a tuple can be of any type and there are no restrictions requiring that those values all be of the same type. A tuple could, for example, be constructed to contain an Int
value, a Double
value, and a String
as follows:
let myTuple = (10, 432.433, "This is a
...