iOS Interview Prep



This content originally appeared on DEV Community and was authored by Harsh Prajapat

📱 iOS stands for iPhone Operating System, and it’s the mobile operating system developed by Apple Inc. to power devices like the iPhone, iPad (until iPadOS split off), and iPod Touch.

🧠 Key Features of iOS:

  • Touch-based interface: Designed for intuitive gestures like tap, swipe, and pinch.
  • App Store: A centralized marketplace for downloading apps, games, and tools.
  • Security & Privacy: Includes features like Face ID, Touch ID, app sandboxing, and frequent updates.
  • Integration: Seamlessly connects with other Apple devices via features like Handoff, AirDrop, and iCloud.
  • Performance: Known for smooth animations, fast app launches, and efficient battery usage.

🕰 A Bit of History:

  • First introduced in 2007 with the original iPhone.
  • Originally called iPhone OS, renamed to iOS in 2010.
  • Has evolved through major updates, with new features like Siri, FaceTime, widgets, and lock screen customization.

🔒 Is It Open Source?

Not really. While some components are open source, iOS is mostly proprietary software, meaning Apple controls its development and distribution.

If you’re curious about how it compares to Android or want to explore app development for iOS, I can walk you through that too. Want to dive deeper?

Let’s walk through what iOS app development involves and the essential tools you’ll need to get started. 🚀

📱 What Is iOS App Development?

iOS app development is the process of creating applications for Apple’s mobile operating system — used on devices like the iPhone, iPad, and iPod Touch. These apps are distributed via the App Store, and developers use Apple’s ecosystem of tools and languages to build them.

🧰 Essential Tools & Software for iOS Development

Here’s a breakdown of the key tools and software you’ll need:

Tool / Software Purpose Notes
Xcode Main IDE for iOS development Includes code editor, debugger, simulator, and Interface Builder
Swift Primary programming language Fast, safe, and modern language developed by Apple
Objective-C Legacy language still used in some apps Older but still supported by Apple
SwiftUI UI framework for building interfaces Declarative syntax, live previews, and cross-platform support
UIKit Traditional UI framework Offers more control and customization than SwiftUI
TestFlight Beta testing platform Used to distribute pre-release apps to testers
CocoaPods Dependency manager Helps manage third-party libraries and frameworks
Firebase Backend services Real-time database, authentication, analytics, and more
AppCode Alternative IDE by JetBrains Supports Swift, Objective-C, and integrates with Xcode
CodeRunner Lightweight IDE for multiple languages Great for quick prototyping and testing

💻 System Requirements

To develop iOS apps, you’ll need:

  • A Mac computer (macOS)
  • Apple Developer Account (for testing on devices and publishing to the App Store)
  • iOS Simulator (comes with Xcode for testing apps without a physical device)

🛠 Optional but Helpful Tools

  • Sketch / Figma: For UI/UX design
  • Git & GitHub: Version control and collaboration
  • Raygun / Charles Proxy: Debugging and performance monitoring tools

😄😄😄

Swift vs Objective-C

Swift and Objective-C are both used for iOS development, but they differ significantly in design, performance, and developer experience. Let’s break it down:

🆚 Swift vs Objective-C: Quick Comparison

Feature Swift Objective-C
Introduced 2014 1984
Syntax Clean, modern, concise Verbose, based on C
Safety Type-safe, memory-safe Prone to null pointer issues
Performance Faster execution, optimized for Apple Slower due to runtime compilation
Learning Curve Easier for beginners Steeper, especially for modern devs
File Management Single file (.swift) Requires header (.h) and implementation (.m) files
UI Frameworks SwiftUI, UIKit UIKit only
Community Support Growing rapidly Mature but shrinking
Legacy Integration Limited backward compatibility Excellent for older iOS versions

🚀 Why Developers Prefer Swift

  • Cleaner Code: Swift reduces boilerplate and improves readability.
  • Safety First: Features like optionals and type inference help catch bugs early.
  • Performance Boost: Swift apps often launch faster and use less memory.
  • Modern Features: Supports generics, closures, and functional programming.

🏛 Why Objective-C Still Matters

  • Legacy Projects: Many enterprise apps still use Objective-C.
  • C Compatibility: Works well with C/C++ libraries.
  • Stability: Less frequent changes, making it reliable for long-term maintenance.

If you’re starting fresh, Swift is the way to go. But if you’re maintaining older codebases or need deep system-level access, Objective-C still has its place.

💡💡💡

🧱 UIKit: The Classic Framework

UIKit has been around since the early days of iOS and is built on Objective-C, though it works well with Swift too.

✅ Pros:

  • Mature & Stable: Decades of development and community support.
  • Fine-Grained Control: Precise management of views, animations, and transitions.
  • Backward Compatibility: Supports older iOS versions (as far back as iOS 9).
  • Interface Builder: Visual UI design via Storyboards in Xcode.

❌ Cons:

  • Verbose Code: Requires more boilerplate and manual updates.
  • Imperative UI Updates: You must manually track and update UI state.
  • Steeper Learning Curve: Especially for beginners unfamiliar with Objective-C patterns.

🌱 SwiftUI: The Modern Approach

Introduced in 2019, SwiftUI is a declarative framework built entirely in Swift.

✅ Pros:

  • Less Code, More Clarity: Define what the UI should look like, and SwiftUI handles the rest.
  • Reactive Updates: UI automatically updates when data changes.
  • Live Previews: See changes instantly in Xcode.
  • Cross-Platform: Works across iOS, macOS, watchOS, and tvOS.
  • Built-in Accessibility & Dark Mode: Comes with modern design features out of the box.

❌ Cons:

  • Limited to iOS 13+: Not ideal for apps supporting older devices.
  • Still Evolving: Missing some advanced features available in UIKit.
  • Debugging Can Be Tricky: Especially with complex view hierarchies.

🧠 When to Use Which?

Scenario Best Choice
Supporting older iOS versions UIKit
Building modern apps for iOS 14+ SwiftUI
Need custom animations or advanced UI control UIKit
Rapid prototyping or small apps SwiftUI
Maintaining legacy codebases UIKit
Learning iOS development today SwiftUI (easier to start with)

You can also combine both in a single project! SwiftUI can embed UIKit views using UIViewRepresentable, and UIKit can host SwiftUI views with UIHostingController.

🛠📱 RxSwift and Combine

RxSwift and Combine are both reactive programming frameworks for Swift. RxSwift is a third-party library, while Combine is Apple’s native framework.

Core Data is Apple’s powerful framework for managing the model layer of your iOS, macOS, watchOS, and tvOS apps. It’s not just a database—it’s an object graph management and persistence framework. Let’s unpack what that means. 📦

🧠 What Core Data Does

  • Stores data persistently (usually in SQLite, but you don’t interact with SQL directly)
  • Manages relationships between objects (like users and their posts)
  • Tracks changes and supports undo/redo
  • Syncs data across devices using iCloud + CloudKit
  • Fetches and filters data efficiently with queries

🧰 Key Components

Component Role
NSManagedObject Your data model objects
NSManagedObjectContext Workspace for creating, editing, and saving objects
NSPersistentContainer Sets up the Core Data stack
.xcdatamodeld file Visual editor for defining entities, attributes, and relationships
NSFetchRequest Used to query data from the store

🛠 How It Works (Simplified)

  1. Define your data model in Xcode (e.g., User, Post, etc.)
  2. Create instances of your entities using NSManagedObject
  3. Save changes to the persistent store via NSManagedObjectContext
  4. Fetch data using NSFetchRequest with optional filters and sorting
  5. Sync or migrate data as your app evolves

🧪 Example: Creating a User

let context = persistentContainer.viewContext
let user = UserEntity(context: context)
user.name = "Alice"
user.age = 30

do {
    try context.save()
} catch {
    print("Failed to save: \(error)")
}

Core Data is ideal for apps with complex data models, offline capabilities, or syncing needs. If you’re building something like a note-taking app, a task manager, or even a social feed, Core Data can be your best friend.

UserDefaults is a super handy tool in iOS for storing small pieces of data persistently — like user preferences, settings, or flags that help your app remember things between launches. Think of it as a lightweight key-value store baked right into the system. 🧠📦

🧰 What You Can Store with UserDefaults

UserDefaults supports basic types:

  • String, Int, Float, Double, Bool
  • URL, Data
  • Array and Dictionary (as long as their contents are property list types)

✍ How to Use It in Swift

✅ Saving Data

UserDefaults.standard.set(true, forKey: "isLoggedIn")
UserDefaults.standard.set("Alice", forKey: "username")
UserDefaults.standard.set(42, forKey: "launchCount")

🔍 Retrieving Data

let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn")
let username = UserDefaults.standard.string(forKey: "username")
let launchCount = UserDefaults.standard.integer(forKey: "launchCount")

🧹 Removing Data

UserDefaults.standard.removeObject(forKey: "username")

🧵 Best Practices

  • Use it for small, non-sensitive data only.
  • Avoid storing large objects or complex models.
  • Don’t use it for secure data like passwords — use Keychain instead.
  • For SwiftUI, you can use @AppStorage to bind values directly to your views.
@AppStorage("isDarkMode") var isDarkMode: Bool = false

UserDefaults is perfect for things like:

  • Remembering if onboarding was shown
  • Storing theme preferences
  • Tracking app usage stats

Want to see how it compares to Core Data or SwiftData for more complex storage? I can walk you through that too. 🧭📱

🔐 Keychain in iOS is Apple’s built-in system for securely storing sensitive data like passwords, cryptographic keys, and certificates. It’s designed to keep your private information safe while making it easy to access across your Apple devices.

🧰 What You Can Store in Keychain

  • Usernames & Passwords for websites and apps
  • Credit Card Info (number, expiration, security code)
  • Wi-Fi Credentials
  • Passkeys for passwordless login
  • Cryptographic Keys for secure communication

🧠 How It Works

Keychain encrypts your data using end-to-end encryption, meaning only your device can decrypt it — not even Apple can access it. It integrates with:

  • Safari for autofilling login credentials
  • Apps that support secure storage
  • iCloud Keychain to sync data across devices

With iOS 18, Apple introduced a standalone Passwords app that replaces the older Keychain interface in Settings, making password management more user-friendly.

🛠 Developer Use: Keychain Services API

If you’re building an app, you can use the Keychain Services API to:

  • Store small secrets like tokens or passwords
  • Retrieve and update secure items
  • Control access with app-specific permissions

Example in Swift:

let password = "secret123"
let account = "user@example.com"

let query: [String: Any] = [
    kSecClass as String: kSecClassGenericPassword,
    kSecAttrAccount as String: account,
    kSecValueData as String: password.data(using: .utf8)!
]

SecItemAdd(query as CFDictionary, nil)

This stores a password securely in the Keychain.

🔒 Security Highlights

  • Uses device-specific keys and Face ID/Touch ID for access
  • Supports shared password groups with trusted contacts
  • Automatically suggests strong passwords and stores them securely

Understanding iOS App States is key to managing your app’s behavior and performance across its lifecycle. Let’s break down the five main states your app can be in:

🚦 iOS App Execution States

State Description
Not Running App is terminated or hasn’t launched yet.
Inactive App is in the foreground but not receiving events (e.g., during a phone call).
Active App is in the foreground and receiving events — fully interactive.
Background App is offscreen but still executing code (e.g., saving data, downloading).
Suspended App is in memory but not executing code. iOS may terminate it to free resources.

🔄 Typical Transitions

  • Launch: Not Running → Inactive → Active
  • Interruption: Active → Inactive (e.g., incoming call)
  • Backgrounding: Inactive → Background → Suspended
  • Resuming: Suspended → Background → Inactive → Active

🧠 Why It Matters

Each state offers a chance to:

  • Save or restore data
  • Pause/resume tasks
  • Release resources
  • Update UI

You handle these transitions using AppDelegate or SceneDelegate methods like:

  • applicationDidBecomeActive
  • applicationWillResignActive
  • applicationDidEnterBackground
  • applicationWillTerminate

Let’s break down both push notifications and rich notifications in iOS so you can see how they work and how they differ. 📲✨

🚀 Push Notifications in iOS

Push notifications are messages sent from a server to a user’s device, even when the app isn’t running. They’re great for alerting users about updates, reminders, or promotions.

🔧 How They Work:

  1. Your app registers with Apple Push Notification Service (APNs).
  2. APNs provides a device token.
  3. Your server uses this token to send notifications via APNs.
  4. The system delivers the notification to the user’s device.

🧰 Key Components:

  • UNUserNotificationCenter: Manages notification delivery and interaction.
  • UNNotificationRequest: Defines the content and trigger.
  • UNNotificationTrigger: Specifies when to deliver (time, location, etc.).

🛠 Developer Setup:

  • Enable Push Notifications in Xcode.
  • Configure App ID and provisioning profile in Apple Developer Console.
  • Use UNUserNotificationCenter to request permission and handle notifications.

🎨 Rich Notifications in iOS

Rich notifications are enhanced push notifications that include media (images, videos, audio, GIFs) and interactive elements like buttons or custom UI.

🌟 Features:

  • Add images, GIFs, videos, or audio to make notifications visually engaging.
  • Include action buttons (e.g., “Reply”, “View”, “Dismiss”).
  • Use custom layouts via Notification Content Extensions.

🧩 Required Setup:

  • Add a Notification Service Extension to modify the notification payload.
  • Add a Notification Content Extension to customize the UI.
  • Include mutable-content: 1 in the payload to trigger the service extension.

🧪 Example Use Case:

A messaging app might show a photo preview in the notification and allow the user to reply directly from the lock screen.

🆚 Push vs Rich Notifications

Feature Push Notification Rich Notification
Content Text only Text + media + actions
Interaction Tap to open app Buttons, reply, custom UI
Setup Complexity Basic Requires extensions & config
iOS Version Support iOS 10+ iOS 10+ (some features newer)

💡 What Are In-App Purchases?

In-App Purchases let users buy digital goods or services directly within your app. Apple handles the payment process via the App Store, so developers don’t need to manage transactions manually.

🧩 Types of In-App Purchases

Type Description Example
Consumable Can be used up and repurchased Game coins, extra lives
Non-Consumable Purchased once, never expires Remove ads, unlock premium features
Auto-Renewable Subscription Recurring access to content Monthly music streaming
Non-Renewing Subscription Access for a fixed time, manual renewal Seasonal event pass

🛠 Example: Unlocking Premium Features

Let’s say you have a note-taking app. You want to offer a Pro version that includes:

  • Unlimited notes
  • Cloud sync
  • Dark mode

You’d set up a non-consumable IAP called "pro_upgrade".

Swift Code Snippet:

import StoreKit

func purchaseProVersion() {
    let payment = SKPayment(product: proProduct)
    SKPaymentQueue.default().add(payment)
}

Once purchased, you unlock the features and store the purchase status securely (often using Keychain or server-side validation).

🧪 Testing IAPs

Use StoreKit Testing in Xcode or TestFlight with sandbox accounts to simulate purchases without spending real money.

🚀 What Is TestFlight?

TestFlight is Apple’s official platform for beta testing iOS apps before they’re released on the App Store. It allows developers to:

  • Share pre-release builds with testers
  • Collect feedback and crash reports
  • Test across multiple Apple platforms (iOS, iPadOS, macOS, watchOS, tvOS, visionOS)

🧩 Key Features:

  • Invite up to 100 internal testers and 10,000 external testers
  • Distribute builds via email invites or public links
  • Test builds for up to 90 days
  • Get feedback via screenshots, comments, and crash logs

You can learn more on Apple’s official TestFlight page.

🧪 Ways to Test iOS Apps

Testing iOS apps involves multiple strategies depending on your goals and app complexity:

1. Unit Testing

  • Tests individual functions or components
  • Ensures logic works as expected
  • Tools: XCTest (built into Xcode)

2. UI Testing

  • Simulates user interactions (taps, swipes, etc.)
  • Validates layout and navigation
  • Tools: XCUITest, Appium

3. Integration Testing

  • Verifies that different modules work together
  • Useful for testing workflows like login or checkout

4. Manual Testing

  • Hands-on testing on real devices or simulators
  • Great for catching visual glitches and UX issues

5. Automated Testing

  • Runs scripted tests across devices and OS versions
  • Speeds up regression testing and CI/CD pipelines
  • Tools: XCUITest, Appium, Testsigma, Kobiton

6. Beta Testing via TestFlight

  • Real users test the app in real-world conditions
  • Helps uncover usability issues and edge cases
  • Feedback is collected directly in App Store Connect

🧠 Best Practices

  • Use real devices for performance and sensor testing
  • Combine manual + automated testing for full coverage
  • Prioritize user-centric testing to improve UX
  • Validate across multiple iOS versions and screen sizes

🧭📲


This content originally appeared on DEV Community and was authored by Harsh Prajapat