Skip to content

dhg-applab/FTKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
    }
}