requires explicit use of 'self' iOS Origin: On your device Last updated 14 Oct 2026

Swift: Reference to property 'x' in closure requires explicit use of 'self' to make capture semantics explicit

In an escaping closure inside a class, Swift requires self. to make the capture (and potential retain cycle) visible.

Exact message you may see requires explicit use of 'self' to make capture semantics explicitReference to property in closure requires explicit use of 'self'Call to method in closure requires explicit use of 'self'
Seen on: iOS

Meaning

Add self. or capture [weak self] / [self] explicitly. For long-lived closures prefer [weak self] to avoid retain cycles.

Common causes

  • Escaping closure referencing instance properties without self
  • Copying code from SwiftUI structs into classes

⚡ Quick fix

  1. Write self.property
  2. Use [weak self] and guard let self
  3. Use [self] capture list when a strong capture is intended

Detailed fix by platform

Swift

  1. swift
    api.load { [weak self] result in
        guard let self else { return }
        self.items = result
    }

How to diagnose

  1. Closure — Escaping and long-lived?
  2. Cycle — Does self own the closure?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Cannot convert value of type — Swift: Cannot convert value of type 'X' to expected argument type 'Y' (iOS)Cannot convert value …Could not cast value of type — Swift: Could not cast value of type 'X' to 'Y' (iOS)Could not cast value …Escaping closure captures mutating 'self' — Swift: Escaping closure captures mutating 'self' parameter (iOS)Escaping closure capt…Index out of range — Swift: Fatal error: Index out of range (iOS)Index out of rangeis only available in iOS x or newer — Swift: 'X' is only available in iOS 16.0 or newer (iOS)is only available in …Main actor-isolated — Swift 6: Main actor-isolated property 'x' can not be referenced from a nonisolated context / Sending 'x' risks causing data races (iOS)Main actor-isolatedType of expression is ambiguous — Swift: Type of expression is ambiguous without a type annotation (more context) (iOS)Type of expression is…unable to type-check this expression in reasonable time — Swift: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions (iOS)unable to type-check …requires …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.