Structures
Model everyday objects using structures!
StartKey Concepts
Review core concepts you need to learn to master this subject
Structure Creation
Default Property Values
Structure Instance Creation
Checking Type
init()
Method
Structure Methods
Mutating Methods
Structure Creation
Structure Creation
struct Building {
var address: String
var floors: Int
init(address: String, floors: Int, color: String) {
self.address = address
self.floors = floors
}
}
Structures, or structs, are used to programmatically represent a real-life object in code. Structures are created with the struct
keyword followed by its name and then body containing its properties and methods.
Structures
Lesson 1 of 1
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory