{"id":30420685,"url":"https://github.com/macabeus/tvlightsegments","last_synced_at":"2025-08-22T08:19:53.172Z","repository":{"id":56924627,"uuid":"89551125","full_name":"macabeus/TvLightSegments","owner":"macabeus","description":"🗂 Apple TV | Clean, simple, and beautiful segment bar for your AppleTv app","archived":false,"fork":false,"pushed_at":"2017-07-23T07:20:25.000Z","size":185,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-11T15:09:04.103Z","etag":null,"topics":["stalkr-internals","swift","tvos","ui-components"],"latest_commit_sha":null,"homepage":"https://cocoapods.org/pods/TvLightSegments","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/macabeus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-27T03:19:38.000Z","updated_at":"2023-02-04T07:09:25.000Z","dependencies_parsed_at":"2022-08-21T05:20:39.575Z","dependency_job_id":null,"html_url":"https://github.com/macabeus/TvLightSegments","commit_stats":null,"previous_names":["brunomacabeusbr/tvlightsegments"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/macabeus/TvLightSegments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macabeus%2FTvLightSegments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macabeus%2FTvLightSegments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macabeus%2FTvLightSegments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macabeus%2FTvLightSegments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/macabeus","download_url":"https://codeload.github.com/macabeus/TvLightSegments/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macabeus%2FTvLightSegments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271606604,"owners_count":24788981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["stalkr-internals","swift","tvos","ui-components"],"created_at":"2025-08-22T08:19:52.788Z","updated_at":"2025-08-22T08:19:53.162Z","avatar_url":"https://github.com/macabeus.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Version](https://img.shields.io/cocoapods/v/TvLightSegments.svg?style=flat)](http://cocoapods.org/pods/TvLightSegments)\n[![License](https://img.shields.io/cocoapods/l/TvLightSegments.svg?style=flat)](http://cocoapods.org/pods/TvLightSegments)\n[![Platform](https://img.shields.io/cocoapods/p/TvLightSegments.svg?style=flat)](http://cocoapods.org/pods/TvLightSegments)\n\n# TvLightSegments\n💜  Clean, simple and beautiful segment bar for your AppleTv app\n\n![](http://i.imgur.com/DxUjToP.png)\n\nYou can download this repository and see this example app.\n\n# How to use\n\n## Install\nIn `Podfile` add\n```\npod 'TvLightSegments'\n```\n\nand use `pod install`.\n\n## Setup\n\nCreate a new CollectionView and set `TvLightSegments` as a custom class\n![](http://i.imgur.com/98hwCVl.png)\n\nYou need create create a class that subscriber `TvLightSegmentsDisplay`. When a segment's focus change, this class notified.\n```swift\nclass ViewDetails: UIViewController, TvLightSegmentsDisplay {\n    \n    @IBOutlet weak var name: UILabel!\n    @IBOutlet weak var textDetails: UITextView!\n    @IBOutlet weak var image: UIImageView!\n    \n    // Oh! A segments' focus was changed! Then, execute this method ⚡️\n    func didChangeSegment(_ segmentItem: TvLightSegmentsItem) {\n        let pokemon = segmentItem as! Pokemon\n        \n        name.text = pokemon.name\n        textDetails.text = pokemon.desc\n        image.image = pokemon.image\n    }\n    \n}\n\n```\n\nAlso, you need create a class that subscriber `TvLightSegmentsItem`. The objects of this class will be the segments.\n\n```swift\nclass Pokemon: TvLightSegmentsItem {\n    \n    let name: String\n    let desc: String\n    \n    init(name: String, desc: String) {\n        self.name = name\n        self.desc = desc\n    }\n    \n    // Text that will show in segment\n    func tvLightSegmentsName() -\u003e String {\n        return name\n    }\n}\n```\n\nNow, in `ViewController`, we need setup the TvLightSegments, with the `setup(viewDisplay:)`:\n\n```swift\nclass ViewMain: UIViewController {\n    @IBOutlet weak var segments: TvLightSegments!\n    ...\n    \n    override func viewDidLoad() {\n        // The parameter need be a TvLightSegmentsDisplay\n        segments.setup(viewDisplay: self.containerViewDetails!)\n```\n\nThen, set the segments, with the `set(segmentsItems:)`:\n\n```swift\nclass ViewMain: UIViewController {\n    ...\n    \n    override func viewDidLoad() {\n        ...\n        \n        // The parameter need be a [TvLightSegmentsItem]\n        segments.set(segmentsItems: [\n            Pokemon(\n                name: \"Pikachu\",\n                desc: \"Pikachu are small, chubby...\"\n            ),\n            Pokemon(\n                name: \"Charmander\",\n                desc: \"Charmander is a small, bipedal...\"\n            ),\n            Pokemon(\n                name: \"Bulbasaur\",\n                desc: \"Bulbasaur resembles a small...\"\n            )\n        ])\n```\n\nAwesome! Now, our TvLightSegments work! 😆\n\n## Optional configs\n\n### Colors\nYou can change the colors.\n\nHey! Change the colors **before** the `setup(viewDisplay:)` method!!\n\n```swift\nsegments.labelColorSelected = UIColor.red\nsegments.labelColorNotSelected = UIColor.blue\nsegments.viewFooterColorSelected = UIColor.green\nsegments.viewFooterColorNotSelected = UIColor.black\n```\n\n### Transition\nSet a transition animation when a segment's focus is changes.\n\nHey! Set the transitions **before** the `set(segmentsItems:)` method!!\n\n```swift\nsegments.transitionConfig = TransitionConfig(\n    transitionStart: { display in\n        return { (display as! UIViewController).view!.alpha = 0 }\n    },\n    transitionStartTime: 0.5,\n    transitionEnd: { display in\n        return { (display as! UIViewController).view!.alpha = 1 }\n    },\n    transitionEndTime: 0.5\n)\n```\n\n**Maintainer**:\n\n\u003e [macabeus](http://macalogs.com.br/) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e GitHub [@macabeus](https://github.com/macabeus)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacabeus%2Ftvlightsegments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacabeus%2Ftvlightsegments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacabeus%2Ftvlightsegments/lists"}