SwiftBlade
Published in

SwiftBlade

How a “lazy var” can be instantiated twice

Explore how lazy stored properties in Swift can go wrong and cause weird bugs

A lazy developer resting on his feature branch from Unsplash

What are Lazy Stored Properties?

Swift “Lazy stored properties” (lazy var) is a powerful feature that can help improve app performance by deferring expensive property initialization until when it is actually used…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Thongchai Kolyutsakul

Thongchai Kolyutsakul

323 Followers

iOS developer since 2009. I write about iOS development, Swift language, and general software engineers tips.