Skip to content
tezvyn:

iOS & Swift

SwiftUI, UIKit, Xcode, Swift language, Apple platforms

129 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.

Interview questions in iOS & Swift, page 6

easy1 min read

Purpose and setup of an Objective-C bridging header

The bridging header imports ObjC headers into Swift; Xcode auto-creates it or you add it manually and set the build setting.

easy1 min read

Diagnosing choppy scrolling performance

Reach for Instruments, especially the Time Profiler and Core Animation/Hangs tools, and look for main-thread work and dropped frames.

intermediate1 min read

Struct versus class performance and memory tradeoffs

Structs are value types, often stack-allocated with no ARC; classes are heap-allocated reference types with retain counts.

intermediate1 min read

Exposing Swift classes to Objective-C

Subclass NSObject or mark members @objc, import the generated ModuleName-Swift.h, and accept that Swift-only types like enums with associated values cannot cross.

intermediate1 min read

What an autoreleasepool is and when to add one manually

An autorelease pool holds objects until it drains; wrap tight loops creating many temporary ObjC objects in autoreleasepool to cap peak memory.

intermediate1 min read

dispatch_async versus Task.detached for offloading work

Dispatch_async submits a closure to a queue; Task.detached starts an unstructured async task off the current actor without inheriting context.

advanced1 min read

The dynamic keyword and message dispatch

Dynamic forces Objective-C message dispatch via objc_msgSend, enabling KVO and swizzling, at the cost of skipping inlining and devirtualization.

advanced2 min read

Verifying and avoiding copy-on-write overhead

Confirm extra copies via isKnownUniquelyReferenced or instruments and the retain trace; ensure unique references, mutate inout/in place, reserveCapacity, avoid aliasing.

advanced2 min read

Debugging a closure capture leak in a third-party library

Use the Memory Graph Debugger to inspect retain paths, the Leaks and Allocations instruments, and malloc stack logging; trace the cycle before patching.

intermediate1 min read

map versus compactMap versus flatMap

Map transforms each element one-to-one; compactMap transforms then drops nils; flatMap transforms to sequences then concatenates.

intermediate1 min read

Copy-on-write and implementing it for a custom struct

CoW shares a buffer until mutation, deep-copying only when the buffer is non-unique; Array, Dictionary, Set, String use it; implement with a class storage box and isKnownUniquelyReferenced.

intermediate2 min read

View identity in SwiftUI and the .id() modifier

Identity links a view to its persistent state and transitions; structural identity comes from position, explicit identity from .id(); changing the id resets state and forces a new view.

intermediate2 min read

Faulting in Core Data

A fault is a placeholder object whose property data is not yet loaded; accessing a property fires the fault and fetches from the store, saving memory.

intermediate1 min read

Minimizing Storyboard merge conflicts

Split into many small storyboards or xibs, or move to programmatic or SwiftUI layout; process-wise coordinate ownership and merge often.

intermediate1 min read

Decoding a heterogeneous JSON array by a type field

Peek the type field with a partial decode, switch on it, and decode the concrete type, wrapping each in an enum or boxed protocol value.

intermediate1 min read

Retain cycles and how to break them

A cycle is two objects (or a closure and its owner) holding mutual strong references so neither deallocates; break it with a [weak] or [unowned] capture list.

intermediate1 min read

Purpose of the guard statement

Guard requires its condition to hold or else exits the scope, and unwrapped optionals stay in scope afterward; this flattens nesting versus if.

intermediate2 min read

Closures and trailing closure syntax

Closures are self-contained function blocks that capture surrounding state; a final closure parameter can be passed as a trailing closure outside the parentheses.

intermediate1 min read

do-try-catch versus Optional return types

Throwing functions with do/try/catch convey why something failed via typed Error values; Optionals only say success or absence. Use throws when the caller needs the reason.

intermediate2 min read

Protocols with associated types and opaque types

A PAT leaves a placeholder type unresolved, so it has no single concrete shape and historically could not be used as a bare existential; opaque types with some let you return one fixed underlying conforming…

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