← All Swift Flashcard Decks

(Mobile Dev) Flashcards

7 cards from real Swift practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 7 (Mobile Dev) flashcards as text
  1. Which Swift property wrapper automatically publishes changes to SwiftUI views in Combine-based code?

    Answer: @Published

    @Published marks a property so that changes automatically broadcast through Combine's ObservableObject protocol.

  2. What is the purpose of `@escaping` in a Swift closure parameter?

    Answer: It allows the closure to outlive the function call

    @escaping tells the compiler the closure may be stored or called after the enclosing function returns.

  3. In UIKit, which method must you call to ensure UI updates happen on the correct thread?

    Answer: DispatchQueue.main.async

    UIKit is not thread-safe, so all UI mutations must be dispatched to DispatchQueue.main.

  4. Which Swift concurrency keyword suspends execution until an async function returns a result?

    Answer: await

    `await` pauses the current async context until the called async function produces its result.

  5. What does the `lazy` keyword do when applied to a stored property in Swift?

    Answer: Delays initialization until first access

    A `lazy` stored property's initializer runs only when the property is first accessed, not at instance creation.

  6. In SwiftUI, which modifier correctly passes a two-way binding into a child view?

    Answer: $variable

    Prefixing a @State or @StateObject variable with `$` produces a Binding for two-way data flow.

  7. Which Foundation class is most appropriate for making HTTP network requests in Swift without third-party libraries?

    Answer: URLSession

    URLSession is Apple's built-in API for performing HTTP/HTTPS data tasks, uploads, and downloads.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy