Browse Questions
  • Use Fastlane's firebaseappdistribution plugin to build an Ad Hoc .ipa and upload it to Firebase — testers receive a download link by email within minutes.
  • Arrays and structs are value types, so changing anything inside them — appending, editing an element, or changing a nested field — counts as setting the whole property to a new value.
  • AsyncStream converts callback or delegate-based event sources into an AsyncSequence you can iterate over with for await.
  • A closure marked @escaping can outlive the function it was passed into — it "escapes" the function's scope.

Answer: A closure marked @escaping can outlive the function it was passed into — it "escapes" the function's scope. Non-escaping closures are executed synchronously before the function returns.

Code Example:

// @escaping — stored and called later (e.g. async completion)
func fetchData(completion: @escaping (Result<Data, Error>) -> Void) {
    URLSession.shared.dataTask(with: url) { data, _, error in
        if let data = data {
            completion(.success(data))
        }
    }.resume()
}

// Non-escaping (default) — called inline, can be optimized by the compiler
func performOperation(action: () -> Void) {
    action() // called immediately, before function returns
}

Key Points:

  • Use @escaping for async callbacks, stored closures, delegate-style patterns
  • Non-escaping closures don't need self. to capture properties