Skip to content
tezvyn:

iOS & Swift

SwiftUI, UIKit, Xcode, Swift language, Apple platforms

28 bites

Test yourself: Top 30 iOS & Swift interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in. No easy set yet. This is the full iOS & Swift quiz.

Easy interview questions in iOS & Swift

easy2 min read

What is the difference between let and var in Swift?

This tests value semantics beyond syntax. A strong answer defines let as immutable and var as mutable, notes that let on a reference type only fixes the pointer, and cites clearer intent and compiler optimization.

easy2 min read

What is an optional in Swift? Demonstrate two safe unwrapping methods.

This checks Swift type safety and nil-handling. A strong answer defines Optional as an enum, demonstrates if let binding, and shows the nil-coalescing operator ?? for defaults. Avoid suggesting force-unwrapping with ! as a safe pattern.

easy1 min read

How does Swift's switch differ from C's switch?

Switches must be exhaustive, there is no implicit fallthrough between cases, and cases can match ranges, tuples, and bind values.

Swift struct vs class: differences and when to choose each
easy2 min read

Swift struct vs class: differences and when to choose each

Tests value vs reference semantics and let mutability. Strong answers contrast copy behavior with shared references, note allocation tendencies, and choose struct for value semantics or class for identity.

easy2 min read

Explain protocols and how extensions provide default implementations

Tests behavior sharing without inheritance. A strong answer defines protocols as requirements, shows extensions injecting default implementations, and contrasts this with base-class inheritance.

Difference between .xcodeproj and .xcworkspace, and when to use a workspace
easy2 min read

Difference between .xcodeproj and .xcworkspace, and when to use a workspace

Tests your mental model of Xcode build containers. A project defines one buildable unit; a workspace groups multiple projects so they build together and share derived data. Use it for package managers or modular codebases.

What LLDB command prints a UIView description versus an Int?
easy2 min read

What LLDB command prints a UIView description versus an Int?

Tests LLDB formatting at breakpoints. Great answers: po invokes description or debugDescription on objects, while p evaluates and prints raw primitive values with type info. Red flag: mixing them up or recommending console print instead of LLDB.

When should you use frame-based layout versus Auto Layout?
easy2 min read

When should you use frame-based layout versus Auto Layout?

Frames suit static or high-frequency UI like particle systems; Auto Layout handles rotation, Dynamic Type, localization, and split screen.

What is @State in SwiftUI and how does it affect the view?
easy2 min read

What is @State in SwiftUI and how does it affect the view?

Tests declarative data flow ownership. A strong answer defines @State as private value-type storage owned by the view that triggers a body re-evaluation on mutation. Red flag: confusing it with external data sources like @ObservedObject or @Binding.

UIViewController lifecycle states: network vs geometry updates
easy2 min read

UIViewController lifecycle states: network vs geometry updates

Tests UIViewController lifecycle states and separation of data vs layout. Strong answers list loadView to viewDidDisappear, start network in viewDidLoad or viewWillAppear, and geometry in viewDidLayoutSubviews. Red flag: network calls inside layout methods.

easy1 min read

Describe the iOS app lifecycle and SceneDelegate methods

Not running, inactive, active, background, suspended; SceneDelegate handles sceneDidBecomeActive, sceneWillResignActive, sceneDidEnterBackground, sceneWillEnterForeground.

easy1 min read

Explain UIKit MVC and the Massive View Controller problem

Model holds data, View displays it, Controller mediates between them; the view controller accretes networking, parsing, and logic into a Massive View Controller.

Implement SwiftUI navigation between list and detail with product ID
easy2 min read

Implement SwiftUI navigation between list and detail with product ID

Tests modern SwiftUI navigation and clean data flow. Great answer: NavigationStack with NavigationLink(value:) and navigationDestination(for:), plus a bound path for programmatic control.

When is UserDefaults right, what are its limits, and native types?
easy2 min read

When is UserDefaults right, what are its limits, and native types?

Tests if you treat UserDefaults as a small preference store, not a database. Good answers name native plist types, cite no encryption and small size limits, and name Core Data or Keychain for heavy or sensitive data. Red flag: storing images or passwords.

How do you persist a custom Swift struct to JSON in Documents?
easy2 min read

How do you persist a custom Swift struct to JSON in Documents?

Tests fluency with Codable and FileManager sandbox APIs. Good answer: conform to Codable, encode with JSONEncoder, resolve Documents directory via FileManager URLs, write Data atomically, and reverse with JSONDecoder.

easy1 min read

Fetch and decode JSON with async/await and URLSession

Call URLSession.shared.data(from:) inside an async throws function, check the HTTPURLResponse status, then JSONDecoder().decode([User].self) and let errors propagate via try.

easy1 min read

Map JSON keys to differently named Codable properties

Declare a nested CodingKeys enum mapping userID to the raw value "user_id", or set the decoder's keyDecodingStrategy to convertFromSnakeCase for blanket conversion.

easy1 min read

Implicit .animation() vs explicit withAnimation

.animation(value:) animates a view when a tracked value changes; withAnimation wraps the state mutation so all dependent views animate.

easy1 min read

Add shadow and rounded corners to a UIView

CornerRadius needs masksToBounds true, but that clips the shadow; set shadowPath to keep both and stay performant.

easy1 min read

Request the user's location one time

Add a usage description to Info.plist, set a CLLocationManager delegate, request when-in-use authorization, call requestLocation, handle didUpdateLocations and didFailWithError.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles