Swift by Sundell cover image

80: “Lists and loops”, with special guest Nick Lockwood

Swift by Sundell

00:00

Swift Foot Gun

Swift's type system is based on the idea of copy on right. Value types have to be fixed size and arrays and strings generally aren't in Swift because they're mutable. So all mutations of that underlying array happen through the struct, which is wrapping the pointer. And again, this is great for performance in one sense, because it means that you're not copying that entire heap object every time you make a new copy of the array. But then you run into this weird edge case where it's the reason why your app is running slow.

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app