Junior Mobile Developer (iOS) Interview Questions: Complete Guide

Milad Bonakdar
Author
Master iOS development fundamentals with essential interview questions covering Swift, UIKit, SwiftUI, data persistence, and iOS app architecture for junior developers.
Introduction
iOS development has become one of the most sought-after skills in mobile app development. With Swift as the primary language and powerful frameworks like UIKit and SwiftUI, iOS developers create experiences for millions of users worldwide.
This guide covers essential interview questions for Junior iOS Developers. We explore Swift fundamentals, UI development, data persistence, networking, and iOS best practices to help you prepare for your first iOS developer role.
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 introduced in iOS 13.
- UIKit: Imperative (you tell the system how to build the UI step by step). Mature, widely used.
- SwiftUI: Declarative (you describe what the UI should look like). Modern, less code, automatic updates.
- Key Features:
- Live preview in Xcode
- Cross-platform (iOS, macOS, watchOS, tvOS)
- State-driven UI updates
- Built-in animations
Rarity: Very Common Difficulty: Easy
13. Explain @State, @Binding, and @ObservedObject in SwiftUI.
Answer: These are property wrappers for managing state in SwiftUI:
@State: Private state owned by the view. When it changes, the view re-renders.@Binding: Creates a two-way connection to a@Stateproperty owned by a parent view.@ObservedObject: References an external object (class conforming toObservableObject). View updates when the object's@Publishedproperties change.
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 for networking tasks.
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:
- Synchronous: Blocks the current thread until the operation completes. Can freeze the UI if run on the main thread.
- Asynchronous: Doesn't block the thread. Operation runs in the background, and a completion handler is called when done.
- Main Thread: UI updates must happen on the main thread. Use
DispatchQueue.main.asyncto switch to the main thread.
Rarity: Common Difficulty: Easy
20. What is Grand Central Dispatch (GCD)?
Answer: GCD is Apple's low-level API for managing concurrent operations.
- Dispatch Queues: FIFO queues that execute tasks serially or concurrently
- Main Queue: Serial queue for UI updates
- Global Queues: Concurrent queues with different priorities (background, utility, userInitiated)
Rarity: Common Difficulty: Medium



