1 post found
lazy var defers a property's initialization until first access — but Swift never promised that first access is safe from two threads at once. Here's what actually happens when it isn't, and how to fix it without giving up the laziness.