0

I have recently started to code on SwiftUI with no knowledge or experience in Application programming. I have a simple eye gaze tracking app using this Framework: https://github.com/ukitomato/EyeTrackKit

Using the given examples i have this code running:

struct ContentView: View { 
@ObservedObject var eyeTrackController: EyeTrackController = EyeTrackController(device: Device(type: .iPad), smoothingRange: 10, blinkThreshold: .infinity, isHidden: true)

var body: some View {
    ZStack(alignment: .topLeading) {
       eyeTrackController.view
       Circle()
            .fill(Color.blue.opacity(0.5))
            .frame(width: 25, height: 25)
            .position(x: eyeTrackController.eyeTrack.lookAtPoint.x, y: eyeTrackController.eyeTrack.lookAtPoint.y)
    }.edgesIgnoringSafeArea(.all)
}

On launch while having the circle it barely moves, updating its position once every 3-5 seconds.

After rotating the device to landscape mode, then immediately rotating back to Portrait mode, the app seems to run perfectly fine, having no stutter and smooth transition between point to point.

Any idea what can cause this issue?

Thanks in advance!

Eran
  • 81
  • 1
  • 6
  • Have you run the example code in their repo? Does it suffer from the same issue for you? – jnpdx Jul 26 '21 at 16:33

1 Answers1

0

After a while i found a solution for this problem:

On the line:

@ObservedObject var eyeTrackController: EyeTrackController = EyeTrackController(device: Device(type: .iPad), smoothingRange: 10, blinkThreshold: .infinity, isHidden: true)

The IsHidden value should be false instead of true

Don't know why excatly, but now the code runs smoothly

Eran
  • 81
  • 1
  • 6