Giter Club home page Giter Club logo

tvosslider's Introduction

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.

tvosslider's People

Contributors

dcordero avatar cgoldsby avatar milosmokic avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.