You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 19, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ A naive (strong key/weak value) dictionary & (weak key/weak value) dictionar
11
11
12
12
Apple provides an existing implementation and you should use it instead. [NSMapTable](https://nshipster.com/nshashtable-and-nsmaptable/) also has the advantage that you dont need to manually trigger clean up of old nil references.
13
13
14
+
It is also worth considering if clean up of references is even needed for your scenario. In cases where the dictionary itself is shortlived or the values are likely to be recreated for the same keys then it is probably sufficient to use a standard swift dictionary with a [weak box wrapper](https://gist.github.com/nicholascross/8285cef20b1f5f171557478647cc0cdd) instead.
15
+
14
16
**What are some differences from NSMapTable?**
15
17
- Use of equality operator for key comparison
16
18
- Supports suscripts and `Collection` protocol inherited behaviour
0 commit comments