Skip to content

Instantly share code, notes, and snippets.

View matipxd's full-sized avatar

Mateusz Pluciak matipxd

  • Fourthwall
  • Poland, Poznań
  • 04:16 (UTC +02:00)
View GitHub Profile
@emaloney
emaloney / guard-closure.md
Last active August 1, 2023 00:24
A simplified notation for avoiding the weak/strong dance with closure capture lists

Simplified notation for avoiding the [weak self]/strongSelf dance with closures

  • Proposal: TBD
  • Author: Evan Maloney
  • Status: Draft
  • Review manager: TBD

Introduction

Frequently, closures are used as completion callbacks for asynchronous operations, such as when dealing with network requests. It is quite common to model these sorts of operations in such a way that an object instance represents a request/response transaction, for example: