Preparing for a technical iOS job interview with questions and answers

This article is a book preview including one example question and answer for every main topic.

Natascha Fadeeva
7 min readJul 25, 2019

This article is a preview of the book Preparing for a technical iOS job interview — with over 200 questions & answers including one example question and answer for every main topic.

Having been a freelance iOS developer for over 10 years, I participated in quite a few hiring interviews for various projects and have also been in a position of leading the technical interviews myself.

With this book, I’d like to give you a guide for technical iOS questions you might be asked in such an interview for an iOS hiring position. It can also be used to get an overview on different iOS development topics and be an inspiration for deepening and expanding your knowledge on your iOS journey.

Each chapter starts with a questions overview that allows you to check your knowledge without seeing the answers. All questions are numerated so you can quickly find the answer if needed. The following topics are covered:

Swift

Being the main programming language for the iOS platform, a deep knowledge in Swift is expected from an iOS developer. This chapter provides questions and answers on Swift and general programming language concepts.

Example question & answer:

Swift is a type-safe language. What does type safety mean?

Type safety means that the compiler prevents type errors. For example when declaring a variable of type Int, we cannot assign a String value to it. The compiler performs type checks and informs us about mismatched types with compiler errors. This enables us to catch and fix type mismatches as early as possible in the development process.

var age: Int = 10
age = "ten" // Compiler error

Objective-C

Objective-C is becoming more and more obsolete after Swift was released in 2014. However, with existing apps written in Objective-C still out there, knowledge on Objective-C may be required for an iOS position. This chapter provides questions and answers on Objective-C basics and the interoperability between Swift and Objective-C.

Example question & answer

What is an implementation file in Objective-C?

An implementation file contains the actual implementation for an Objective-C class. It implements all methods defined in the header file and also contains private properties and methods.

The syntax to declare a class implementation looks as follows:

SomeClass.m

#import "SomeClass.h"

@implementation SomeClass
// implement public methods
// define & implement private properties and methods
@end

Xcode

Being the main iOS development tool, a confident usage of Xcode is expected from an iOS developer. This chapter provides questions and answers on working and debugging with Xcode.

Example question & answer

What is an Xcode scheme?

An Xcode build scheme defines configurations for actions like building, running, testing, profiling etc. When we execute one of those actions, Xcode uses the selected build scheme to determine what to do.

Only one scheme can be active at a time. We can customize existing schemes created by Xcode or create new ones as needed.

For example, we can configure launch arguments to pass to the app, execute scripts before or after any action or produce different builds like a debug or release build.

SwiftUI

Since 2019, SwiftUI is Apple’s main framework for building user interfaces for iOS. This chapter provides questions and answers on the main aspects of SwiftUI.

Example question & answer

What is the entry point of a SwiftUI application?

Starting with iOS 14, Apple introduced the App protocol for pure SwiftUI applications which mostly replaced the AppDelegate and SceneDelegate. A most basic SwiftUI App implements the body property as entry point of the application.

@main
struct ExampleApp: App {

var body: some Scene {
WindowGroup {
ContentView()
}
}
}

UIKit

With SwiftUI slowly pushing UIKit into the background, UIKit is still part of many existing iOS applications. A deep knowledge of UIKit may be required for an iOS position. This chapter provides questions and answers around key aspects of UIKit.

Example question & answer

What is the concept behind intrinsic content size of a UIView?

Intrinsic content size represents the amount of space a view needs to display its content. A view can have an intrinsic content height, width or both.

For example, the intrinsic content size of a UILabel will be the size of the text it contains.

Not all views have an intrinsic content size. When defining a custom view, we are able to decide if it has an intrinsic content size depending on how we setup the view’s constraints.

Combine

With the release of Combine at WWDC 2019, Apple introduced a native way to write functional reactive code. This chapter provides questions and answers on Combine and on functional reactive programming concepts in general.

Example question & answer

What is the difference between a subject and a publisher in Combine?

A publisher exposes values of a certain type over time and can be completed or optionally fail with an error. A subject is basically a mutable publisher i.e. it has the ability to send new values after its initialization.

Server Communication

Server communication is part of almost every iOS application. This chapter provides questions and answers on general computer networking concepts and on specific iOS networking topics.

Example question & answer

What are the main components of a HTTP URL? What purpose do they have?

Every HTTP URL consists of the following main components:

scheme://host:port/path?query
  • Scheme — The scheme identifies the protocol used to access a resource, e.g. http or https.
  • Host — The host name identifies the host that holds the resource.
  • Port — Host names can optionally be followed by a port number to specify what service is being requested.
  • Path — The path identifies a specific resource the client wants to access.
  • Query — The path can optionally by followed by a query to specify more details about the resource the client wants to access.

Concurrency

Apple introduced Swift’s async/await syntax during WWDC21, allowing us to write asynchronous code in a shorter and safer way. This chapter focuses on this concurrency model with async/await. It also provides questions and answers on more low-level technologies like Grand Central Dispatch and Operations. Since they were used in iOS applications before async/await, knowledge around these technologies may be required for an iOS position.

Example question & answer

How can we bridge a completion handler into an async function in Swift?

To write our own async/await functions, Swift provides so called continuations which give us control over suspending and resuming a function.

To bridge a completion handler function, we can use Swift’s withCheckedContinuation function:

func load() async -> Int {
return await withCheckedContinuation({ continuation in
load() { result in
continuation.resume(returning: result)
}
})
}

By using withCheckedContinuation, we suspend from the function and call resume() after we get a result from the completion handler. Resuming from a continuation must happen exactly once.

Persisting Data

Persisting pieces of data is required in many applications. For different scenarios, Apple offers different ways to store data. This chapter contains questions and answers on the iOS File System, UserDefaults, Keychain and the Core Data framework.

Example question & answer

What is a database migration? What is the difference between a lightweight and a heavyweight migration when working with Core Data?

A database migration is performed whenever we need to change the structure of the objects i.e. make changes to the data model.

For a specific set of changes, Core Data can perform an almost automatic data migration, also called lightweight migration. Examples of those changes are adding, renaming or deleting entities, attributes or relationships, changing the relationship type and more.

When changes to the data model exceed the capabilities of a lightweight migration, we need to do a heavyweight i.e. manual migration.

Security

Many applications need to manage some kind of sensitive user data. To ensure a high level of security, Apple provides different technologies to be used by developers. This chapter provides questions and answers on specific security-related iOS technologies such as keychain or shared web credentials, as well as general cryptography concepts.

Example question & answer

What are use cases of a hash function?

Cryptographic hash functions have many security applications, for example in digital signatures, message authentication, password verification and more.

Let’s look at the password verification example in more detail. When a user enters a password into our app to login, we hash the entered password and send it to the server for verification. Passwords stored on the server are also computed hash values of the original passwords. This way, we never store the original password or send it over the network but still are able to verify it.

Automated Testing

Testing is an important part in every software development process. Apple offers tools to write unit, UI and performance tests for iOS applications. This chapter provides questions and answers on general testing concepts and specific iOS testing tools.

Example question & answer

How can we use the XCTUnwrap method when writing unit tests?

The XCTest framework provides the XCTUnwrap method which attempts to unwrap an optional and throws an error i.e. lets the test fail if the optional is nil.

func testMixingSmoothies() throws {
let smoothieMaker = SmoothieMaker()
let bananaSmoothie = try XCTUnwrap(smoothieMaker.makeBananaSmoothie())
}

This approach eliminates the need to write repeating XCTFail descriptions. All we need to do is to mark our test function with throws.

Originally published at https://tanaschita.com on July 25, 2019.

--

--

Natascha Fadeeva

Writing articles about iOS and Swift programming. Not active here anymore. Checkout tanaschita.com for up-to-date articles.