Using Collections Effectively
Using Collections Effectively
WWDC 2018
The fisrt elements of an array

The second elements of an array

We can make it better!

Slices

Copying a slice

Eager Functions

Lazy Functions
- Chained computation
- Only need part of a result
- No side effects
- Avoid API boundaries

Avoid Index Invalidation
Common Pitfall


MultiThreaded Mutable Collections

Forming New collections
Use capacity hints if possible

Value and Reference Collections

ObjC — Swift Bridge Examples

Identifying Bridging Problems

Solution
