Atomic vs. Non Atomic Properties Crash Course

Atomic Properties

Atomic Properties and Threads Example

point = CGPoint(x: 10, y: 10)
  • Thread A tries to read the CGPoint property
  • Thread B is setting point = CGPoint(x: 1, y: 1)
  • Thread C is setting point = CGPoint(x: 5, y: 5)
(x = 10, y = 10)(x = 1, y = 1)(x = 5, y = 5)
(x = 1, y = 1)(x = 5, y = 5)

Non Atomic Properties

Non Atomic Properties and Threads Example

How does the Objective-C runtime do this?

What about Swift?

--

--

--

iOS lead at Mint

Love podcasts or audiobooks? Learn on the go with our new app.

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
Yogev Sitton

Yogev Sitton

iOS lead at Mint

More from Medium

👾 Apollo Integration Fun on iOS

Crowdin CDN— streamline the localization process (iOS)

iOS hardware accelerated 2D terrain visualisation in OzRunways

BottomSheet in iOS 15: ​​UISheetPresentationController and its capabilities