🌍 iOS Development · flashcards

iOS Development Swift Programming Flashcards

67 question-and-answer cards covering Swift Programming as it is examined in iOS Development. 24 of them are printed below, taken from across the deck — no signup, no paywall on the preview.

67Cards in deck
24Free preview
21Syllabus topics
~231Chars per answer
FreePrice

24 sample cards from the Swift Programming deck

Sampled from the end of the deck, so these are different cards from the ones shown on the syllabus page.

  1. How do you make one Operation wait for another to finish using OperationQueue?

    Use 'operationB.addDependency(operationA)', which makes operationB start only after operationA finishes. This lets you build ordered execution graphs across concurrent operations.

  2. What do the 'async' and 'await' keywords mean in Swift concurrency?

    'async' marks a function as asynchronous, meaning it can suspend. 'await' marks a suspension point where the function may pause to wait for an async call to return, freeing the thread to do other work without blocking it.

  3. What is a Task in Swift's structured concurrency?

    A Task represents a unit of asynchronous work that runs concurrently. Creating 'Task { await doWork() }' provides an async context from synchronous code. Tasks can be awaited, cancelled, and can inherit priority and actor context.

  4. What is an 'actor' in Swift concurrency and what problem does it solve?

    An actor is a reference type that protects its mutable state from data races by ensuring only one task accesses its isolated state at a time (serialized access). Accessing an actor's properties/methods from outside generally requires 'await'.

  5. How does 'async let' enable parallel asynchronous work?

    'async let' starts an asynchronous operation concurrently and binds a placeholder for its future result. Multiple 'async let' bindings run in parallel; you use 'await' when you actually need the values, e.g. 'async let a = fetchA(); async let b = fetchB(); let result = await (a, b)'.

  6. In Swift, how do you define custom error types?

    Define a type (commonly an enum) that conforms to the Error protocol. Example: 'enum NetworkError: Error { case timeout, badURL, serverError(code: Int) }'. Conforming enums can carry associated values for extra context.

  7. What is the purpose of the 'throws' keyword in a function signature?

    'throws' marks a function as able to throw (propagate) errors. Example: 'func loadData() throws -> Data'. Callers must handle the potential error using try within a do-catch, try?, or try!.

  8. Explain the do-try-catch structure for error handling in Swift.

    A 'do' block contains code that may throw; each throwing call is prefixed with 'try'. If an error is thrown, execution jumps to a matching 'catch' block, which receives the error (bound to 'error' by default) so it can be handled.

  9. What is the difference between 'try', 'try?', and 'try!' in Swift?

    'try' propagates a thrown error and must be used in a do-catch or throwing function. 'try?' converts the result to an optional, returning nil if an error is thrown. 'try!' asserts that no error will be thrown and crashes at runtime if one is.

  10. What does the 'defer' statement do in Swift error handling and scope management?

    A 'defer' block schedules code to run just before the current scope exits, regardless of how it exits (normal return, thrown error, or break). It is commonly used for cleanup like closing files or releasing resources.

  11. What is SwiftUI and how does its programming paradigm differ from UIKit?

    SwiftUI is Apple's declarative UI framework introduced in 2019. You describe what the UI should look like for a given state, and the framework renders and updates it automatically. UIKit is imperative, requiring you to manually create, configure, and mutate view objects.

  12. What is the 'body' property of a SwiftUI View and what type does it return?

    Every View conforms to the View protocol and must provide a computed 'body' property that returns 'some View' (an opaque type). The body describes the view's content and layout, and SwiftUI re-invokes it to recompute the UI when state changes.

  13. What is the '@State' property wrapper in SwiftUI?

    @State declares a source of truth for simple, local, mutable state owned by a single view. SwiftUI stores it outside the view struct and automatically re-renders the view's body whenever the @State value changes.

  14. What is the difference between '@State' and '@Binding' in SwiftUI?

    @State creates and owns a piece of local state within a view. @Binding creates a two-way reference (not ownership) to state owned elsewhere, letting a child view read and modify a parent's @State. You pass a binding with the '$' prefix, e.g. '$isOn'.

  15. Compare '@StateObject' and '@ObservedObject' in SwiftUI.

    Both work with reference-type models conforming to ObservableObject. @StateObject creates and owns the object, instantiating it once for the view's lifetime. @ObservedObject references an object created and owned elsewhere and does not manage its lifecycle.

  16. What is '@EnvironmentObject' used for in SwiftUI?

    @EnvironmentObject injects a shared ObservableObject into the environment so any descendant view can access it without passing it explicitly through each initializer. It is set with the '.environmentObject()' modifier on an ancestor view.

  17. What do the SwiftUI stack views VStack, HStack, and ZStack do?

    VStack arranges its child views vertically (top to bottom). HStack arranges them horizontally (leading to trailing). ZStack overlays them along the z-axis (back to front), aligning them on top of one another.

  18. What is a view modifier in SwiftUI and how does chaining order affect the result?

    A view modifier is a method that returns a new, modified copy of a view, e.g. '.padding()', '.foregroundColor(.red)'. Order matters because each modifier wraps the previous result; for example applying '.padding()' before vs after '.background()' produces different layouts.

  19. How do you efficiently build a scrolling list of many rows in SwiftUI, and why use identifiable data?

    Use 'List' or a ScrollView with 'ForEach'. ForEach needs each element to be uniquely identified (conforming to Identifiable or via a keyPath id) so SwiftUI can diff, reuse, and animate rows correctly as data changes.

  20. What is URLSession used for in Swift?

    URLSession is Foundation's API for performing HTTP/HTTPS network requests: downloading and uploading data, files, and streams. It manages a group of related network tasks and supports configuration for caching, timeouts, and background transfers.

  21. Name the three main task types provided by URLSession.

    URLSessionDataTask (fetches data into memory, e.g. JSON from an API), URLSessionUploadTask (uploads data or files to a server), and URLSessionDownloadTask (downloads a file to disk, supporting background download).

  22. What is the modern async/await way to fetch data with URLSession, and what does it return?

    Call 'let (data, response) = try await URLSession.shared.data(from: url)'. It returns a tuple of the downloaded Data and the URLResponse, throwing on error, eliminating the need for completion-handler callbacks.

  23. After receiving data from URLSession, how do you decode JSON into a Swift type?

    Make the target type conform to Decodable (or Codable), then use JSONDecoder: 'let model = try JSONDecoder().decode(MyType.self, from: data)'. The decoder maps JSON keys to the type's properties automatically.

  24. When handling a URLSession completion handler, why must you dispatch UI updates to the main thread?

    URLSession delivers its completion handlers on a background thread by default. Since UI updates must occur on the main thread, you wrap them in 'DispatchQueue.main.async { }' (or use @MainActor / await MainActor.run) to avoid crashes.

What this deck covers

The Swift Programming deck follows the iOS Development Swift Programming syllabus — 9 chapters and 21 topics — so questions land on material that is genuinely examinable rather than trivia around it. That works out to roughly 7.4 cards per chapter.

Answers are written to be recallable, not just readable — averaging about 231 characters, which is long enough to carry the reasoning and short enough to say out loud.

A deck like this earns its keep on the second and third pass. Read the syllabus first so you know the shape of the subject, then use the cards to find the specific facts that have not stuck.

Swift Programming flashcards FAQ

How many Swift Programming flashcards are in this iOS Development deck?

67 cards. This page previews 24 of them, sampled evenly across the deck so you can judge the difficulty before installing anything.

Are these iOS Development flashcards free?

Yes. The preview here is free to read with no signup, and the full 67-card deck is free inside the Examius app.

What do the Swift Programming cards cover?

They follow the iOS Development Swift Programming syllabus — 9 chapters and 21 topics — so the questions track what is actually examinable.

How should I use these flashcards?

Read the syllabus first so you know the shape of the subject, then drill the deck. Examius schedules each card with spaced repetition, so cards you keep missing come back sooner and ones you know drift further apart.