TvOSSlider is an implementation of UISlider for tvOS.

Related tags

Apple TV TvOSSlider
Overview

TvOSSlider

Build Status License MIT Swift 5.0

TvOSSlider is an implementation of UISlider for tvOS.

Description and usage

TvOSSlider palliates missing an implementation of UISlider for tvOS as part of UIKit.

We think that Apple might eventually include UISlider for tvOS as part of UIKit, because of that, and in order to make it easier to migrate to a possible future UIKit component, TvOSSlider has been implemented with the same public API as UISlider for iOS.

The interface only differs in a couple of new properties that were considered needed for a Big Screen implementation:

  • stepValue: Value added or subtracted from the current value as result of Siri Remote click left or right updates.
  • focusScaleFactor: Scale factor applied to the slider when receiving the focus.
import UIKit
import TvOSSlider

class ViewController: UIViewController {

    @IBOutlet private weak var slider: TvOSSlider!
    @IBOutlet private weak var valueLabel: UILabel!

    override func viewDidLoad() {
        super.viewDidLoad()

        slider.addTarget(self, action: #selector(sliderValueChanges), for: .valueChanged)
        slider.minimumValue = 0
        slider.maximumValue = 100
        slider.stepValue = 10
        slider.minimumTrackTintColor = .orange
    }

    @objc
    func sliderValueChanges(slider: TvOSSlider) {
        valueLabel.text = "\(slider.value)"
    }
}

Requirements

  • tvOS 11.0+
  • Xcode 11

Installation

Cocoapods

To integrate TvOSSlider into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :tvos, '11.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'TvOSSlider', :git => 'https://github.com/zattoo/TvOSSlider.git'
end

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate TvOSSlider into your Xcode project using Carthage, specify it in your Cartfile:

github "zattoo/TvOSSlider" ~> 1.2.0

Run carthage update to build the framework and drag the built TvOSSlider.framework into your Xcode project.

Manually

If you prefer, you can also integrate TvOSSlider into your project manually, just copying and linking the framework with your project.

Comments
  • Swift 4.2 and Xcode 10

    Swift 4.2 and Xcode 10

    I updated TvOSSlider to Xcode 10 and Swift 4.2.

    I did not bump the version in the podspec.

    I also saw that other repos are removing the .swift-version file.

    opened by cgoldsby 2
  • Slider stepValue doesn't seem to be recognised

    Slider stepValue doesn't seem to be recognised

    When setting stepValue to 1 it is impossible to make the interface increase by just one, seems to step by around 10 increments. Maybe this could be tied in to issue #16 and when using the click buttons only step up or down by one multiple of the step value?

    opened by PlasmaSoftUK 1
  • Using Left or Right Click on latest Apple TV remote doesn't work

    Using Left or Right Click on latest Apple TV remote doesn't work

    Trying to alter the value with the latest Apple TV remote when using click instead of swipe doesn't work. The control wobbles like it received input but its not possible to alter the value using this method. As a side effect this breaks the control for 3rd Party IR remotes which also use the old style Presses with .leftArrow and .rightArrow.

    opened by PlasmaSoftUK 1
  • setValue for TvOSSlider

    setValue for TvOSSlider

    hello, please i'm trying to set value for the tvosslider programmatically on viewDidLoad like this slider.setValue(50.0, animated: true) but the slider not moving it stay at 0 please help

    thank you

    opened by mirco1000 0
  • Can not scrub through the Slider

    Can not scrub through the Slider

    I am creating the TVOSSlider programatically when added Min, Max values with stepValue, slider is only working when I tap left and right of the siri remote. It is not working to scrub over the slider.

    opened by viswakodela 0
  • Ignore vertical swipe on the slider

    Ignore vertical swipe on the slider

    Hi Zattoo,

    You can probably ignore vertical swipe during moving slider's knob. I had a problem when changing focus between slider and buttons below the slider (play, pause...), vertical swipe on the remote also triggers slider 'valueChanged' event.

    Btw. awesome pods, I'm thankful.

    Regards, Milos

    opened by MilosMokic 0
  • Issues when setting an initial Value other than 0

    Issues when setting an initial Value other than 0

    This control works reasonably well, thank you for the time you put in to it. When using this control I want to set an initial value which I do with:

    let slider = TvOSSlider(frame: CGRect(x: 100 y: 100, width: 1000, height: 50))
    slider.minimumValue = 0
    slider.maximumValue = 255
    slider.value = 50
    view.addSubview(slider)
    

    The control takes this value, and when you read it back it returns 50, however the visual slider in the UI remains at 0. When you start to move it, the control resets its value to 0 and starts incrementing from there. Would be great if this could display the correct initial value.

    opened by PlasmaSoftUK 1
Owner
Zattoo
Zattoo
YouTube video player for iOS, tvOS and macOS

About XCDYouTubeKit is a YouTube video player for iOS, tvOS and macOS. Are you enjoying XCDYouTubeKit? You can say thank you with a tweet. I am also a

Cédric Luthi 2.9k Dec 21, 2022
Google Analytics tracker for Apple tvOS provides an easy integration of Google Analytics’ measurement protocol for Apple TV.

Google Analytics tracker for Apple tvOS by Adswerve About Google Analytics tracker for Apple tvOS provides an easy integration of Google Analytics’ me

Adswerve 81 Nov 13, 2022
tvOS controls and extensions that add parallax effect to your application.

ParallaxView Summary Easy to use UIView, UICollectionViewCell with parallax effect and extensions to add this effect to any UIView. Rotate view using

PGS Software 466 Nov 13, 2022
Light and scrollable view controller for tvOS to present blocks of text

TvOSTextViewer Light and scrollable view controller for tvOS to present blocks of text Description TvOSTextViewer is a view controller to present bloc

David Cordero 45 Oct 27, 2022
Light wrapper of UIButton that allows extra customization for tvOS

FocusTvButton Light wrapper of UIButton that allows extra customization for tvOS If you would like to have the same level of customization in tablevie

David Cordero 68 Nov 12, 2022
📺 A tvOS button which truncates long text with '... More'.

TvOSMoreButton ?? A tvOS button which truncates long text with '... More'. The TvOSMoreButton is a simple view which aims to mirror the behavior of Ap

Chris Goldsby 56 Oct 27, 2022
PIN keyboard for tvOS

TvOSPinKeyboard PIN keyboard for tvOS Description TvOSPinKeyboard is a view controller that allows easily asking for PIN codes in tvOS. Requirements t

Zattoo 102 Oct 5, 2022
Light wrapper of UITableViewCell that allows extra customization for tvOS

TvOSCustomizableTableViewCell Light wrapper of UITableViewCell that allows extra customization for tvOS If you would like to have the same level of cu

Zattoo 31 Nov 9, 2022
StepSlider its custom implementation of slider such as UISlider for preset integer values.

StepSlider StepSlider its custom implementation of slider such as UISlider for preset values. Behind the scenes StepSlider manipulate integer indexes.

spromicky 520 Dec 20, 2022
UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.

MultiSlider UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizo

Yonat Sharon 326 Dec 29, 2022
RangeSeedSlider provides a customizable range slider like a UISlider.

RangeSeekSlider Overview RangeSeekSlider provides a customizable range slider like a UISlider. This library is based on TomThorpe/TTRangeSlider (Objec

WorldDownTown 644 Dec 12, 2022
A UISlider subclass that displays the slider value in a popup view

ASValueTrackingSlider ###What is it? A UISlider subclass that displays live values in an easy to customize popup view. ![screenshot] (http://alskipp.g

Al Skipp 1.8k Dec 16, 2022
A slider, similar in style to UISlider, but which allows you to pick a minimum and maximum range.

TTRangeSlider A slider, similar in style to UISlider, but which allows you to pick a minimum and maximum range. Installation TTRangeSlider is availabl

Tom Thorpe 952 Dec 2, 2022
RangeSeedSlider provides a customizable range slider like a UISlider.

RangeSeekSlider Overview RangeSeekSlider provides a customizable range slider like a UISlider. This library is based on TomThorpe/TTRangeSlider (Objec

WorldDownTown 644 Dec 12, 2022
UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.

MultiSlider UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizo

Yonat Sharon 326 Dec 29, 2022
A custom UIControl which functions like UISlider where you can set multiple intervals with different step values for each interval.

MultiStepSlider A custom UIControl which functions like UISlider where you can set multiple intervals with different step values for each interval. Th

Susmita Horrow 25 Apr 28, 2022
Versatile Video Player implementation for iOS, macOS, and tvOS

News ?? - Since 2.1.3 VersaPlayer now supports iOS, macOS, and tvOS Example Installation Usage Basic Usage Adding Controls Advanced Usage Encrypted Co

Jose Quintero 723 Dec 26, 2022
Spin aims to provide a versatile Feedback Loop implementation working with the three main reactive frameworks available in the Swift community (RxSwift, ReactiveSwift and Combine)

With the introduction of Combine and SwiftUI, we will face some transition periods in our code base. Our applications will use both Combine and a thir

Spinners 119 Dec 29, 2022
Swift implementation of the longest common subsequence (LCS) algorithm.

SwiftLCS SwitLCS provides an extension of Collection that finds the indexes of the longest common subsequence with another collection. The longest com

Tommaso Madonia 212 Dec 29, 2022
Swift implementation of Github REST API v3

GitHubAPI Swift implementation of GitHub REST api v3. Library support Swift 4.2. Work is in progress. Currently supported: Issues API. Activity API(Fe

Serhii Londar 77 Jan 7, 2023