Track gazing position 👀 with ARKit
See EyeTrackerSample
for more details.
private let eyeTracker = EyeTracker()
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if EyeTracker.isSupported {
eyeTracker.delegate = self
eyeTracker.start()
}
}
// MARK: - EyeTrackerDelegate
func eyeTracker(_ eyeTracker: EyeTracker, didUpdateTrackingState state: EyeTracker.TrackingState) {
switch state {
case let .screenIn(screenPos):
// ...
case let .screenOut(edge, screenPos):
// ...
case .notTracked:
// ...
case .pausing:
// ...
}
}
You can use CocoaPods to install EyeTracker
by adding it to your Podfile
:
platform :ios, '11.0'
use_frameworks!
pod 'EyeTracker'
Create a Cartfile
that lists the framework and run carthage bootstrap
. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/YourLibrary.framework
to an iOS project.
github "sidepelican/EyeTracker"
MIT