Swift is a strongly typed language. Every value has a type, and the compiler enforces that you use values in type-safe ways. In this chapter, you'll learn about Swift's built-in types, how type inference works, and how to convert between types.
Type Inference
Swift can figure out the type of a value from context, so you don't always have to write it explicitly:
let age = 25 // Int (inferred)
let price = 9.99 // Double (inferred)
let name = "Swift" // String (inferred)
let isActive = true // Bool (inferred)
You can also declare types explicitly using a type annotation:
let age: Int = 25
let price: Double = 9.99
let name: String = "Swift"
let isActive: Bool = true
Both approaches produce the same result. Use type annotations when the type isn't obvious from the value, or when you want to be explicit for clarity.
Full content for this chapter will be added in a future update. The complete article covers type conversion, numeric types (Int, Double, Float), String operations, string interpolation, tuples, and Unicode fundamentals.
Ship your apps faster
When you're ready to publish your Swift app to the App Store, Simple App Shipper handles metadata, screenshots, TestFlight, and submissions — all in one place.
Try Simple App Shipper