Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 1.31 KB

File metadata and controls

32 lines (21 loc) · 1.31 KB

FTKit

A package to enable face tracking by using Apple's ARKit.

This package exposes the blendShapes, lookAtPoint, lightEstimate, depthmap, and distanceToScreen

Starting the face tracking can be done either by using the UIKit/SwiftUI view and run FTKit.shared.start() or hidden on a host view (most top view controller) by running FTKit.shared.start(hiddenOnView:).

Setup

NSCameraUsageDescription needs to be set in the the host app

TopViewController Extension

extension UIApplication {
    func topMostViewController() -> UIViewController? {
        let keyWindow = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
        
        if var topController = keyWindow?.rootViewController {
            while let presentedViewController = topController.presentedViewController {
                topController = presentedViewController
            }
            return topController
        }
        return nil
    }
}