Swiftpack.co - Package - avreolko/VCWeakContainer

VCWeakContainer

A generic container with weak references to its contents. Can be useful when you need an array of weak references 👦🏻

Installation

Install with SPM 📦

Usage

var array = [Weak<NSString>](https://raw.github.com/avreolko/VCWeakContainer/blob/master/)

var string: NSString? = NSString(string: "Hi!")

array.append(.init(string!))
array.append(.init(string!))
array.append(.init(string!))
array.append(.init(string!))

string = nil

print(array.map { $0.object }.compactMap { $0 }.count) // 0

Github

link
Stars: 0

Dependencies

Used By

Total: 0