Swift programs use small built-in types constantly. The most common are String, Int, Double, and Bool.
Strings
A String stores text:
let firstName = "Maya"
let message = "Welcome, \(firstName)"
The \(firstName) syntax is string interpolation. Swift evaluates the expression inside the parentheses and inserts it into the string.
Strings are values, not loose character bags. Swift handles Unicode correctly, which matters for names, emoji, accented characters, and text from real users.
Numbers
Use Int for whole numbers:
let unreadMessages = 12
let page = 1
Use Double for decimal values:
let price = 19.99
let progress = 0.75
Swift does not automatically mix numeric types:
let count = 3
let price = 9.99
let total = Double(count) * price
The conversion is explicit because it can change meaning. Swift prefers visible conversions over hidden surprises.
Booleans
A Bool is either true or false:
let isLoggedIn = true
let hasUnreadMessages = false
Booleans are useful when they answer a clear yes-or-no question. Name them that way: isEnabled, hasPermission, canRetry.
Avoid stringly typed state
Do not use strings for values that have a limited set of valid states:
let status = "loading"
This is easy to mistype and hard for the compiler to protect. Later, you will use enums for this:
enum LoadingState {
case idle
case loading
case failed
}
This is a core Swift habit: use the type system to model what is valid.
What to carry forward
Stringstores textIntstores whole numbersDoublestores decimal numbersBoolstores true-or-false state- Swift requires explicit numeric conversions
- prefer meaningful types over magic strings
Next, you will use these values in control flow.