How does Swift's Dictionary work under the hood?
Walk through Swift Dictionary as a CoW hash table — hashing invariants, collisions, complexity traps, nil removal, ordering, concurrency, and key design for senior interviews
Tag
Start from this tag, then add more in the filter bar to narrow further. The URL keeps your choices so you can bookmark or share the same view.
Walk through Swift Dictionary as a CoW hash table — hashing invariants, collisions, complexity traps, nil removal, ordering, concurrency, and key design for senior interviews
Compare Dictionary and NSCache on one concrete example, an image cache for a photo feed, and show where the two diverge on thread safety, automatic eviction, and key and value rules
Demonstrate Copy-on-Write with a value-typed linked list that shares storage on assignment and copies it only when a mutation occurs using isKnownUniquelyReferenced.
Under ARC, strong keeps an object alive, unowned tracks a direct non-owning pointer that must outlive use, and weak goes through a side table so access can become nil after deinit
Define retain cycles in ARC terms, show the most common ways teams create them, and explain how to prevent and debug them in production code
Explain MemoryLayout, padding, alignment, and stride; show why stored-property order changes a struct's footprint; and connect it to arrays, performance, and low-level interop