Junior iOS Developer Interview Questions: Swift, UIKit, SwiftUI

Milad Bonakdar
Author
Practice junior iOS interview questions on Swift, UIKit, SwiftUI, networking, persistence, and async code, with concise answers for first mobile roles.
Introduction
For a junior iOS developer interview, expect questions that test whether you can explain Swift fundamentals, build simple UI in UIKit or SwiftUI, fetch and decode data, choose basic persistence, and avoid common memory or threading mistakes. The best answers are short, concrete, and tied to how you would build a small app.
Use this guide to practice the questions most likely to appear in an entry-level iOS screen: what the concept means, when you would use it, and what risk a junior developer should watch for.
Swift Fundamentals (6 Questions)
1. What is the difference between var and let in Swift?
Answer:
var: Declares a mutable variable. Its value can be changed after initialization.let: Declares an immutable constant. Once set, its value cannot be changed.- Best Practice: Use
letby default for safety and clarity. Only usevarwhen you know the value will change.
Rarity: Very Common Difficulty: Easy
2. Explain Optionals in Swift. What is Optional Binding?
Answer:
Optionals represent a value that might be nil (absence of a value).
- Declaration: Use
?after the type:var name: String? - Unwrapping Methods:
- Force Unwrapping:
name!(dangerous, crashes if nil) - Optional Binding: Safely unwrap using
if letorguard let - Nil Coalescing:
name ?? "Default" - Optional Chaining:
user?.address?.city
- Force Unwrapping:
Rarity: Very Common Difficulty: Easy
3. What is the difference between a class and a struct in Swift?
Answer:
- Class: Reference type (stored on heap). Supports inheritance. Passed by reference.
- Struct: Value type (stored on stack). No inheritance. Passed by copy.
- When to use:
- Struct: For simple data models, when you want value semantics (independent copies)
- Class: When you need inheritance, reference semantics, or deinitializers
Rarity: Very Common Difficulty: Medium
4. What are Closures in Swift?
Answer: Closures are self-contained blocks of functionality that can be passed around and used in your code. They're similar to lambdas or anonymous functions in other languages.
- Syntax:
{ (parameters) -> ReturnType in statements } - Capturing Values: Closures can capture and store references to variables from their surrounding context.
- Common Use: Completion handlers, callbacks, array operations.
Rarity: Very Common Difficulty: Medium
5. Explain the difference between weak and unowned references.
Answer: Both are used to prevent retain cycles (memory leaks) in reference types.
weak: Optional reference that automatically becomesnilwhen the referenced object is deallocated. Use when the reference might outlive the object.unowned: Non-optional reference that assumes the object will always exist. Crashes if accessed after deallocation. Use when you're certain the reference won't outlive the object.
Rarity: Common Difficulty: Medium
6. What are Protocols in Swift?
Answer: Protocols define a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality. Classes, structs, and enums can adopt protocols.
- Similar to: Interfaces in other languages
- Protocol Extensions: Can provide default implementations
- Protocol-Oriented Programming: Swift's preferred paradigm
Rarity: Very Common Difficulty: Easy
UIKit Basics (5 Questions)
7. What is the difference between UIView and UIViewController?
Answer:
UIView: Represents a rectangular area on the screen. Handles drawing and event handling. Examples:UILabel,UIButton,UIImageView.UIViewController: Manages a view hierarchy. Handles view lifecycle, user interactions, and navigation. Contains one root view and manages its subviews.- Relationship: A view controller manages views. One view controller can have many views.
Rarity: Very Common Difficulty: Easy
8. Explain the View Controller lifecycle methods.
Answer: View controllers have specific lifecycle methods called in order:
viewDidLoad(): Called once when the view is loaded into memory. Setup that needs to happen once.viewWillAppear(_:): Called before the view appears on screen. Can be called multiple times.viewDidAppear(_:): Called after the view appears on screen. Start animations here.viewWillDisappear(_:): Called before the view disappears.viewDidDisappear(_:): Called after the view disappears. Clean up resources.
Rarity: Very Common Difficulty: Easy
9. What is Auto Layout and how do you use constraints?
Answer: Auto Layout is a constraint-based layout system that allows you to create adaptive UIs that work across different screen sizes and orientations.
- Constraints: Define relationships between views (width, height, spacing, alignment)
- Methods:
- Interface Builder: Visual editor in Xcode
- Programmatic: NSLayoutConstraint or NSLayoutAnchor API
- Visual Format Language: String-based (less common now)
Rarity: Very Common Difficulty: Medium
10. What is the difference between frame and bounds?
Answer:
frame: The view's location and size in its superview's coordinate system. Used for positioning the view.bounds: The view's location and size in its own coordinate system. Origin is usually (0, 0). Used for drawing content inside the view.- Key Difference:
frameis relative to parent,boundsis relative to itself.
Rarity: Common Difficulty: Medium
11. How do you handle user input from a UITextField?
Answer: Multiple approaches exist:
- Target-Action: Add target for
.editingChangedevent - Delegate: Conform to
UITextFieldDelegateprotocol - Combine: Use publishers (modern approach)
Rarity: Very Common Difficulty: Easy
SwiftUI Basics (4 Questions)
12. What is SwiftUI and how is it different from UIKit?
Answer:
SwiftUI is Apple's declarative UI framework. You describe the interface as a function of state, and SwiftUI updates the rendered view when that state changes. UIKit is imperative: you create and mutate view objects such as UIView, UILabel, and UIViewController directly.
For a junior interview, do not frame this as SwiftUI replacing UIKit everywhere. Many production apps still mix both. A strong answer is: SwiftUI is concise for new screens and state-driven UI; UIKit remains important for older codebases, custom controls, and APIs that are not fully covered by SwiftUI.
Rarity: Very Common Difficulty: Easy
13. Explain @State, @Binding, and @ObservedObject in SwiftUI.
Answer: These wrappers describe where state lives and who is allowed to change it.
@State: Private state owned by one view, usually for simple local UI state.@Binding: A two-way connection to state owned by a parent view. The child can read and write it without owning it.@ObservedObject: A reference to external observable model data. Use it when another object owns the data and the view should refresh when that object changes. In newer SwiftUI code, you may also see the Observation framework and@Observable, but many interviews still ask about these wrappers.
Rarity: Common Difficulty: Medium
14. How do you create a list in SwiftUI?
Answer:
Use the List view to display scrollable collections of data.
Rarity: Common Difficulty: Easy
15. What are View Modifiers in SwiftUI?
Answer: View modifiers are methods that create a new view with modified properties. They're chainable.
- Common Modifiers:
.padding(),.background(),.foregroundColor(),.font(),.frame() - Order Matters: Modifiers are applied in sequence
Rarity: Common Difficulty: Easy
Data & Networking (5 Questions)
16. How do you make a network request in iOS?
Answer:
Use URLSession. In modern Swift, a junior-friendly answer can show async/await, then mention that older codebases may still use completion handlers. A good production answer also validates the HTTP response, handles errors, decodes into Codable models, and updates UI on the main actor.
Rarity: Very Common Difficulty: Medium
17. What is Codable in Swift?
Answer:
Codable is a type alias for Encodable & Decodable protocols. It allows easy conversion between Swift types and external representations like JSON.
- Automatic Synthesis: Swift automatically generates encoding/decoding code if all properties are Codable.
- Custom Keys: Use
CodingKeysenum to map different property names.
Rarity: Very Common Difficulty: Easy
18. How do you persist data locally in iOS?
Answer: Multiple options for local data persistence:
- UserDefaults: Simple key-value storage for small amounts of data (settings, preferences)
- File System: Save files to Documents or Cache directory
- Core Data: Apple's framework for object graph management and persistence
- SQLite: Relational database
- Keychain: Secure storage for sensitive data (passwords, tokens)
Rarity: Very Common Difficulty: Easy
19. What is the difference between synchronous and asynchronous operations?
Answer:
A synchronous operation blocks the current thread until it finishes. That is dangerous on the main thread because the app can stop responding. An asynchronous operation starts work and lets the current thread continue; the result arrives later through async/await, a completion handler, a delegate, or a publisher.
For iOS interviews, connect the concept to UI responsiveness: network calls, file work, and heavy processing should not block the main thread, and UI changes should run on the main actor.
Rarity: Common Difficulty: Easy
20. What is Grand Central Dispatch (GCD)?
Answer: GCD is Apple's lower-level API for scheduling work on dispatch queues. The main queue is used for UI work, and global queues can run background work with different quality-of-service priorities.
In newer Swift code, you will often use Swift concurrency (async/await, Task, and actors) first because it makes asynchronous code easier to read. GCD still matters because many UIKit projects, older codebases, and callback-based APIs use DispatchQueue.main.async or background queues.
Rarity: Common Difficulty: Medium


