ReceiptSpindle
open class ReceiptSpindle
Allows you to store related receipts together in a single place, to
prevent proliferation of Receipt references that might defeat certain
memory management strategies, such as relying on automatic de-registration
upon Receipt deallocation.
-
Creates a new
ReceiptSpindleusing the specifiedLockMechanism.Declaration
Swift
public init(lock mechanism: LockMechanism = .readWrite)Parameters
mechanismA
LockMechanismvalue that governs the type of lock used for protecting concurrent access to the spindle. -
Adds a receipt to the spindle, ensuring that the receipt (and the object it references) is not deallocated.
Declaration
Swift
open func add(_ receipt: Receipt) -> ObjectIdentifierParameters
receiptThe
Receiptto add to the spindle.Return Value
A receipt identifier that can be used to remove
receiptfrom the spindle at a later time. -
Removes the
Receipts with the given identifiers from the spindle.Declaration
Swift
open func remove(_ receiptIDs: [ObjectIdentifier]) -> IntParameters
receiptIDsThe
ObjectIdentifiers of theReceipts to be removed from the spindle.Return Value
The number of receipts removed from the spindle.
-
Removes the
Receiptwith the given identifier from the spindle.Declaration
Swift
open func remove(_ receiptID: ObjectIdentifier) -> BoolParameters
receiptIDThe
ObjectIdentifierof theReceiptto be removed from the spindle.Return Value
trueif there was aReceipton the spindle for thereceiptIdentifier(and it was removed);falseif nothing was done because no receipt with the given identifier was found on the spindle.
View on GitHub
ReceiptSpindle Class Reference