Swift async-await vs closures

Swift await works by capturing the context and suspending the execution until the called async method returns. Another thing that works similarly by capturing the surrounding context is an escaping closure. So async-await calls can be imagined as equivalent to escaping closure. Whenever you see a method with async mentally replace that method with a escaping completion handler.

Using UnfairLock with Swift

UnfairLock seems to be causing a lot of confusion for Swift developers. Every once in a while I run across some incorrect implementation that reads like:

Mixing Metal with UIScrollView

About mixing UIScrollView with MTKView. This is the trick I learned from WWDC 2012 Enhancing User Experience with Scroll Views session that talks about mixing UIScrollView with OpenGL. The idea is to simply use the MTKView to render whatever metal content we would like and then use the UIScrollView to provide with the scrolling effect. The benefit of using UIScrollView is that we get exactly the same dragging and bounciness behavior that iOS users expect.