Key Concepts

Review core concepts you need to learn to master this subject

Swift Class

// Using data types: class Student { var name: String var year: Int var gpa: Double var honors: Bool } // Using default property values: class Student { var name = "" var year = 0 var gpa = 0.0 var honors = false }

A class is used to programmatically represent a real-life object in code. Classes are defined by the keyword class followed by the class name and curly braces that store the class’s properties and methods.

Classes
Lesson 1 of 1

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo