Programming in Swift: Fundamentals

Oct 19 2021 · Swift 5.5, iOS 15, Xcode 13

Part 2: Beginning Collections

11. Tuples

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 10. Introduction Next episode: 12. Challenge: Tuples

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Notes: 11. Tuples

Update Notes: The student materials have been reviewed and are updated as of October 2021.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

So far, you’ve been working with single pieces of data like an Integer or a String.

let studentMark: 
let studentMark: (String, Int)
let studentMark: (String, Int) = ("Chris", 49)
//                  0      1
let studentMark: (String, Int) = ("Chris", 49)
studentMark.0
studentMark.0
let studentData = (name: "Chris", mark: 49, petName: "Mango")
let theName = studentData.name // gives you the name of the student
let theMark = studentData.mark // gives you the mark of the student
let thePetName = studentData.petName /// gives you the name of the student's pet
let (name, mark, pet) = studentData
name
mark
pet
let (name, �_, pet) = studentData