Class declaration syntax
📖 Scenario: You are creating a simple app to keep track of pets in a pet store. Each pet has a name and an age.
🎯 Goal: Build a Swift class called Pet with properties for name and age.
📋 What You'll Learn
Create a class named
PetAdd a property
name of type StringAdd a property
age of type IntCreate an instance of
Pet with name "Buddy" and age 3Print the pet's name and age
💡 Why This Matters
🌍 Real World
Classes help organize data and behavior for real-world objects like pets, users, or products in apps.
💼 Career
Understanding class syntax is essential for building apps in Swift, especially for iOS development.
Progress0 / 4 steps