UIAutoScroll supports natural scrolling through the gaze. You must use SeeSo to use gaze coordinates.
The Swift Package Manager is a tool for managing the distribution of Swift code. To use UIAutoScroll with Swift Package Manager, add it to dependencies in your Package.swift
dependencies: [
.package(url: "https://github.com/visualcamp/UIAutoScroll.git")
]Firstly, import UIAutoScroll.
import UIAutoScrollThen, there are two ways you can create UIAutoScrollView
-
By storyboard, changing class of
UIScrollViewtoUIAutoScrollview.Note: Set
ModuletoUIAutoScroll. -
By code, using an initializer.
UIAutoScrollView(frame: frame)Start Auto Scrolling.
autoScrollView.startAutoScroll()Stop Auto Scrolling.
autoScrollView.stopAutoScroll()Adjusting the scroll distance through gaze coordinates.
autoScrollView.calcScrollDistance(gazeY : gazeInfo.y)-
accelerationFactor: How fast the scroll moves. Default is 1. A bigger number makes the scroll faster.
-
scrollSpeed: scrollSpeed is the amount of scroll distance moved per second.
-
timeInterval: Default is 60fps.
-
scrollRegion: Bottom portion of the screen where the scroll is activated.
setParameters(timeInterval : 30, scrollSpeed : 0.4, scrollRegion : 0.5, accelerationFactor : 1.5) {The MIT License (MIT)
Copyright (c) 2021 SeeSo
