Skip to content

UIScroll supports natural scrolling through the gaze.

License

Notifications You must be signed in to change notification settings

visualcamp/UIAutoScroll

Repository files navigation

UIAutoScroll

swift-version xcode-version license Swift-package-manager

Introduction

UIAutoScroll supports natural scrolling through the gaze. You must use SeeSo to use gaze coordinates.

Example

Example Project preview

Installation

Swift Package Manager

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")
]

Usage

Firstly, import UIAutoScroll.

import UIAutoScroll

Initialization

Then, there are two ways you can create UIAutoScrollView

  • By storyboard, changing class of UIScrollView to UIAutoScrollview.

    Note: Set Module to UIAutoScroll.

  • By code, using an initializer.

UIAutoScrollView(frame: frame)

Control

Start Auto Scrolling.

autoScrollView.startAutoScroll()

Stop Auto Scrolling.

autoScrollView.stopAutoScroll()

Adjusting the scroll distance through gaze coordinates.

autoScrollView.calcScrollDistance(gazeY : gazeInfo.y)

Change properties

  • 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) {

License

The MIT License (MIT)

Copyright (c) 2021 SeeSo