All Projects β†’ macabeus β†’ Tvlightsegments

macabeus / Tvlightsegments

Licence: mit
πŸ—‚ Apple TV | Clean, simple and beautiful segment bar for your AppleTv app.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Tvlightsegments

Brickkit Ios
DEPRECATED - BrickKit For IOS
Stars: ✭ 613 (+2965%)
Mutual labels:  tvos, ui-components
Blueprints
πŸŒ€ Blueprints - A framework that is meant to make your life easier when working with collection view flow layouts.
Stars: ✭ 874 (+4270%)
Mutual labels:  tvos
Feathersui Starling
User interface components for Starling Framework and Adobe AIR
Stars: ✭ 934 (+4570%)
Mutual labels:  ui-components
Ui Bibz
Ui Frameworks based on Bootstrap and Ruby on Rails
Stars: ✭ 9 (-55%)
Mutual labels:  ui-components
Difference
Simple way to identify what is different between 2 instances of any type. Must have for TDD.
Stars: ✭ 837 (+4085%)
Mutual labels:  tvos
Vtacknowledgementsviewcontroller
Acknowledgements screen displaying a list of licenses, for example from CocoaPods dependencies.
Stars: ✭ 863 (+4215%)
Mutual labels:  tvos
Tinderclone
Android UI clone of the official Tinder ❀ app
Stars: ✭ 24 (+20%)
Mutual labels:  ui-components
Elm Ui
UI library for making web applications with Elm
Stars: ✭ 878 (+4290%)
Mutual labels:  ui-components
Swiftui Grid
πŸš€ SwiftUI Grid layout with custom styles
Stars: ✭ 872 (+4260%)
Mutual labels:  tvos
Ios Cmake
A CMake toolchain file for iOS, macOS, watchOS & tvOS C/C++/Obj-C++ development
Stars: ✭ 844 (+4120%)
Mutual labels:  tvos
Ui Box
Blazing Fast React UI Primitive
Stars: ✭ 847 (+4135%)
Mutual labels:  ui-components
Eva
πŸ’«Customizable Design System easily adaptable to your Brand.
Stars: ✭ 843 (+4115%)
Mutual labels:  ui-components
Zircleui
πŸš€ zircle-ui is a frontend library to develop zoomable user interfaces.
Stars: ✭ 870 (+4250%)
Mutual labels:  ui-components
Refraction
Collection of React components used at Quid
Stars: ✭ 27 (+35%)
Mutual labels:  ui-components
Showkase
πŸ”¦ Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
Stars: ✭ 873 (+4265%)
Mutual labels:  ui-components
Apprepositorytemplate
The easiest way to start a new application project without any manual configuration
Stars: ✭ 24 (+20%)
Mutual labels:  tvos
Sdwebimageswiftui
SwiftUI Image loading and Animation framework powered by SDWebImage
Stars: ✭ 844 (+4120%)
Mutual labels:  tvos
Procedurekit
Advanced Operations in Swift
Stars: ✭ 863 (+4215%)
Mutual labels:  tvos
Uiv
Bootstrap 3 components implemented by Vue 2.
Stars: ✭ 882 (+4310%)
Mutual labels:  ui-components
Request.swift
A tiny HTTP client written in swift. URLSession alternative
Stars: ✭ 14 (-30%)
Mutual labels:  tvos

Version License Platform

TvLightSegments

πŸ’œ Clean, simple and beautiful segment bar for your AppleTv app

You can download this repository and see this example app.

How to use

Install

In Podfile add

pod 'TvLightSegments'

and use pod install.

Setup

Create a new CollectionView and set TvLightSegments as a custom class

You need create create a class that subscriber TvLightSegmentsDisplay. When a segment's focus change, this class notified.

class ViewDetails: UIViewController, TvLightSegmentsDisplay {
    
    @IBOutlet weak var name: UILabel!
    @IBOutlet weak var textDetails: UITextView!
    @IBOutlet weak var image: UIImageView!
    
    // Oh! A segments' focus was changed! Then, execute this method ⚑️
    func didChangeSegment(_ segmentItem: TvLightSegmentsItem) {
        let pokemon = segmentItem as! Pokemon
        
        name.text = pokemon.name
        textDetails.text = pokemon.desc
        image.image = pokemon.image
    }
    
}

Also, you need create a class that subscriber TvLightSegmentsItem. The objects of this class will be the segments.

class Pokemon: TvLightSegmentsItem {
    
    let name: String
    let desc: String
    
    init(name: String, desc: String) {
        self.name = name
        self.desc = desc
    }
    
    // Text that will show in segment
    func tvLightSegmentsName() -> String {
        return name
    }
}

Now, in ViewController, we need setup the TvLightSegments, with the setup(viewDisplay:):

class ViewMain: UIViewController {
    @IBOutlet weak var segments: TvLightSegments!
    ...
    
    override func viewDidLoad() {
        // The parameter need be a TvLightSegmentsDisplay
        segments.setup(viewDisplay: self.containerViewDetails!)

Then, set the segments, with the set(segmentsItems:):

class ViewMain: UIViewController {
    ...
    
    override func viewDidLoad() {
        ...
        
        // The parameter need be a [TvLightSegmentsItem]
        segments.set(segmentsItems: [
            Pokemon(
                name: "Pikachu",
                desc: "Pikachu are small, chubby..."
            ),
            Pokemon(
                name: "Charmander",
                desc: "Charmander is a small, bipedal..."
            ),
            Pokemon(
                name: "Bulbasaur",
                desc: "Bulbasaur resembles a small..."
            )
        ])

Awesome! Now, our TvLightSegments work! πŸ˜†

Optional configs

Colors

You can change the colors.

Hey! Change the colors before the setup(viewDisplay:) method!!

segments.labelColorSelected = UIColor.red
segments.labelColorNotSelected = UIColor.blue
segments.viewFooterColorSelected = UIColor.green
segments.viewFooterColorNotSelected = UIColor.black

Transition

Set a transition animation when a segment's focus is changes.

Hey! Set the transitions before the set(segmentsItems:) method!!

segments.transitionConfig = TransitionConfig(
    transitionStart: { display in
        return { (display as! UIViewController).view!.alpha = 0 }
    },
    transitionStartTime: 0.5,
    transitionEnd: { display in
        return { (display as! UIViewController).view!.alpha = 1 }
    },
    transitionEndTime: 0.5
)

Maintainer:

macabeus  Β·  GitHub @macabeus

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].