ARPaint demonstrates how to draw in the air with bare fingers using ARKit and Vision libraries introduced in iOS 11.
Read this article: iOS ARKit Tutorial: Drawing in the Air with Bare Fingers
for detailed description of how this code work and how to get started with ARKit.
ARKit is available on any iOS 11 device, but the world tracking features that enable high-quality AR experiences require a device with the A9 or later processor.