1/61
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is a String in Swift?
A data type used for text. Any value written inside "quotation marks" — e.g. let profileName: String = "AppDesigner10"
What is an Int in Swift?
A data type used for whole numbers (no decimals). Best for counting items — e.g. var followerCount: Int = 150
What is a Double in Swift?
A data type used for decimal numbers. Best for precision or money — e.g. var averageRating: Double = 4.7
What is a Bool in Swift?
A data type used for True or False values — either true or false. Think of it like a light switch (on or off) — e.g. var isVerified: Bool = true
What are the four main data types in Swift?
String (text), Int (whole numbers), Double (decimal numbers), Bool (true/false).
What is the full syntax for declaring a variable with a type annotation in Swift?
keyword name: Type = value — e.g. let profileName: String = "AppDesigner10" or var followerCount: Int = 150
What is the difference between let and var in Swift?
let declares a constant — the value can never change after it is set. var declares a variable — the value can be updated at any time.
When should you use let?
When the value should never change — e.g. an app name, a username, a year joined, or a daily step goal.
When should you use var?
When the value will change over time — e.g. a follower count, a score, a height, or a notification setting.
What is camelCase and when is it used in Swift?
A naming convention where the first word is all lowercase and each following word starts with a capital letter, with no spaces — e.g. followerCount, isDarkMode, userBio. Always used for variable and constant names in Swift.
What are the three self-check questions before declaring a variable?
1) Should the value never change? Use let. 2) Will the value change? Use var. 3) Does the name start lowercase with no spaces (camelCase)?
What is a data model in app development?
A plan that defines exactly what data your app needs to track, store, and display — developers create this before building any screens.
What is a View in SwiftUI?
Everything visible on screen is a View — text, images, buttons, and whole screens are all views that can be combined together.
What is View Composition in SwiftUI?
The process of building complex screens by nesting small, simple views inside each other, rather than writing one giant messy screen.
What is a VStack?
A container view that arranges its child views Vertically — top to bottom.
What is an HStack?
A container view that arranges its child views Horizontally — left to right.
What is a ZStack?
A container view that layers its child views on top of each other by Z-index (depth), like stacking pieces of paper.
Which stack would you use to place an icon and a label side by side in a row?
HStack — it arranges items horizontally, left to right.
Which stack would you use to place a title above a subtitle?
VStack — it arranges items vertically, top to bottom.
What does .font(.headline) do in SwiftUI?
Applies a bold, larger headline style to a Text view — used for primary titles.
What does .font(.subheadline) do in SwiftUI?
Applies a smaller, secondary text style to a Text view — used for supporting details below a headline.
What is semantic layout in SwiftUI?
Describing the position of elements by their intent (e.g. "leading") rather than fixed pixel values, so layouts adapt correctly across different languages and screen sizes.
What does "Leading" mean in SwiftUI layout?
The start of the view — in English this is the left side. In right-to-left languages it would be the right side.
What does "Trailing" mean in SwiftUI layout?
The end of the view — in English this is the right side.
What is Padding in SwiftUI?
Invisible breathing room added around a view so it does not touch the edges of the screen or other views. Added with .padding()
What is Alignment in SwiftUI?
How items inside a stack line up relative to each other — e.g. VStack(alignment: .leading) lines all children up along the left edge.
How do you add padding only on one side in SwiftUI?
Use .padding(.bottom, 10) or .padding(.leading) etc. — specify the side and optionally the amount in points.
What is the ContentView structure in SwiftUI?
The main file of a SwiftUI app. It contains a struct conforming to View with a body property that returns the layout of the screen.
How do you add an image from the Resources folder in SwiftUI?
Use Image("filename") — e.g. Image("cat"). The image file must be added to the Resources folder in Swift Playgrounds first, with a short lowercase filename and no spaces.
What modifiers are used to make an image circular and sized correctly in SwiftUI?
.resizable(), .scaledToFit(), .frame(width: 200, height: 200), .clipShape(Circle()) — applied in that order after Image("filename").
What does .foregroundColor(.gray) do in SwiftUI?
Changes the text colour to gray — commonly used for captions or secondary text.
What is an if statement in Swift?
A decision-maker that checks if a condition is true and runs a block of code if it is. If the condition is false, the else block runs instead.
What is an else statement in Swift?
The "Plan B" block of code that runs when the if condition is false — ensures the user always gets a response from the app.
When should you use an if-else statement?
When your app has two possible paths — e.g. if a user is logged in, show their profile; else show the sign-up screen.
What does the == operator do in Swift?
Checks if two values are exactly equal — e.g. if score == 100. Used for comparison, not assignment.
What does the != operator do in Swift?
Checks if two values are NOT equal — e.g. if username != "Admin"
What does the > operator do in Swift?
Checks if the left value is greater than the right — e.g. if balance > 50
What does the < operator do in Swift?
Checks if the left value is less than the right — e.g. if age < 18
What does the >= operator do in Swift?
Checks if the left value is greater than or equal to the right — e.g. if cardBalance >= 25
What is the "double equals trap" in Swift?
Confusing == (comparison — asking "is it equal?") with = (assignment — setting a value). Always use == inside if conditions.
What is the curly brace rule in if-else statements?
All code that should run as part of the if or else must be "hugged" inside curly braces { } — e.g. if condition { print("yes") } else { print("no") }
What is a function in Swift?
A named, reusable block of code that performs a specific task. You define it once and call it by name whenever you need it.
What keyword do you use to define a function in Swift?
func — e.g. func playMusic() { }
What is the syntax for defining a basic function with no parameters in Swift?
func functionName() { // code to run }
How do you call (run) a function in Swift?
Write the function name followed by parentheses — e.g. playMusic()
What is a parameter in a Swift function?
A placeholder variable defined inside the function's parentheses that allows the function to accept input — e.g. func orderFood(item: String)
What is an argument in a Swift function?
The actual value you pass in when calling the function — e.g. orderFood(item: "Pizza") — "Pizza" is the argument.
What does () do inside a Swift string?
String interpolation — it injects the value of a variable directly into a string. e.g. print("You ordered (item)") prints the actual item value, not the word "item".
Why does order matter when defining and calling functions in Swift?
Swift must read and know what a function is before it can run it — always define the function above the line where you call it.
What is the difference between a function with no parameters and one with parameters?
No parameters: func greet() { } — does the same thing every time. With parameters: func greet(name: String) { } — behaves differently based on the input passed in.
What is a For-In loop in Swift?
A loop that repeats a block of code a set number of times or once for every item in a list. It is the "repeat button" for your code.
What is the syntax of a basic For-In loop in Swift?
for _ in 1…5 { // action } — the underscore means you don't need to use the number, and 1…5 sets the range.
What does the _ mean in a For-In loop?
It means you don't need to use the loop's current number — you just want the action to repeat the given number of times.
What does 1…5 mean in a Swift For-In loop?
A closed range — the loop runs from 1 to 5, inclusive, meaning the action repeats 5 times.
How do you count down in a For-In loop in Swift?
Use (1…10).reversed() to loop from 10 down to 1, or use stride(from: 10, to: 0, by: -1).
What is an Array in Swift?
An ordered list of items of the same type stored in a single variable — e.g. var myItems = ["Laptop", "Mouse", "Keyboard"]
What is the syntax for creating an array in Swift?
var arrayName = ["item1", "item2", "item3"] — items are separated by commas inside square brackets [ ].
How do you loop through every item in an array in Swift?
Use a for-in loop: for item in myArray { print(item) } — the loop runs once for each item in the array.
What does the loop constant represent when looping through an array?
It is a temporary name that holds the current item the loop is processing — e.g. for student in students means student holds one name at a time.
What does .count do on an array in Swift?
Returns the number of items in the array — e.g. animals.count returns 3 if the array has 3 items.
What is the relationship between a For-In loop and an Array?
The array is the "shopping list" (the data), and the for-in loop is the "repeat machine" that processes each item in that list one by one.
What happens when a For-In loop reaches the end of an array?
The loop automatically stops — it does not need to know the number of items in advance, it just stops when there are no more items left.