Skip to content
This repository was archived by the owner on Jun 19, 2022. It is now read-only.

Commit 59a371d

Browse files
Update README.md
1 parent ef298ce commit 59a371d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ A naive (strong key/weak value) dictionary & (weak key/weak value) dictionar
1111

1212
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.
1313

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+
1416
**What are some differences from NSMapTable?**
1517
- Use of equality operator for key comparison
1618
- Supports suscripts and `Collection` protocol inherited behaviour

0 commit comments

Comments
 (0)