swift-book
swift-book copied to clipboard
Clarify Defining a Capture List
Location
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/automaticreferencecounting#Defining-a-Capture-List https://docs.swift.org/swift-book/documentation/the-swift-programming-language/expressions#Capture-Lists
Description
The first paragraph in the Defining a Capture List subsection reads:
Each item in a capture list is a pairing of the weak or unowned keyword with a reference to a class instance (such as self) or a variable initialized with some value (such as delegate = self.delegate). These pairings are written within a pair of square braces, separated by commas.
According to the Capture List subsection examples and text, while an expression may begin with the weak or unowned keyword, it isn't required. Also, an entry in a capture list need not be a reference type, but could be a value type.
Correction
Reword the first paragraph in the Defining a Capture List subsection to:
Precede each reference type item in a capture list with a capture specifier, that is, either weak, unowned, unowned(safe), or unowned(unsafe). A reference type item may be either a reference to an actor or class instance (such as self for a closure within a class) or a variable initialized with some value (such as delegate = self.delegate). A capture list item may also be a value type, but these are not involved with reference cycles. A capture list is delimited with square brackets and adjacent items are separated with commas.