{"id":16948616,"url":"https://github.com/timoliver/tosegmentedcontrol","last_synced_at":"2025-08-05T04:10:14.660Z","repository":{"id":35115227,"uuid":"201594772","full_name":"TimOliver/TOSegmentedControl","owner":"TimOliver","description":"A segmented control in the style of iOS 13 compatible with previous versions of iOS.","archived":false,"fork":false,"pushed_at":"2022-01-23T06:56:03.000Z","size":273,"stargazers_count":198,"open_issues_count":7,"forks_count":25,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-07-23T01:06:42.430Z","etag":null,"topics":["cocoapods","ios","objective-c","segmented-control","uikit"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/TimOliver.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"timoliver","custom":"https://tim.dev/paypal"}},"created_at":"2019-08-10T07:17:04.000Z","updated_at":"2025-06-06T10:03:41.000Z","dependencies_parsed_at":"2022-08-08T05:01:36.601Z","dependency_job_id":null,"html_url":"https://github.com/TimOliver/TOSegmentedControl","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/TimOliver/TOSegmentedControl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimOliver%2FTOSegmentedControl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimOliver%2FTOSegmentedControl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimOliver%2FTOSegmentedControl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimOliver%2FTOSegmentedControl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimOliver","download_url":"https://codeload.github.com/TimOliver/TOSegmentedControl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimOliver%2FTOSegmentedControl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268831635,"owners_count":24314243,"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-05T02:00:12.334Z","response_time":2576,"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":["cocoapods","ios","objective-c","segmented-control","uikit"],"created_at":"2024-10-13T21:51:38.852Z","updated_at":"2025-08-05T04:10:14.595Z","avatar_url":"https://github.com/TimOliver.png","language":"Objective-C","funding_links":["https://github.com/sponsors/timoliver","https://tim.dev/paypal","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=M4RKULAVKV7K8"],"categories":[],"sub_categories":[],"readme":"# TOSegmentedControl\n\n![TOSegmentedControl](screenshot.jpg)\n\n[![CI](https://github.com/TimOliver/TOSegmentedControl/workflows/CI/badge.svg)](https://github.com/TimOliver/TOSegmentedControl/actions?query=workflow%3ACI)\n[![Version](https://img.shields.io/cocoapods/v/TOSegmentedControl.svg?style=flat)](http://cocoadocs.org/docsets/TOSegmentedControl)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/TimOliver/TOSegmentedControl/master/LICENSE)\n[![Platform](https://img.shields.io/cocoapods/p/TOSegmentedControl.svg?style=flat)](http://cocoadocs.org/docsets/TOSegmentedControl)\n[![PayPal](https://img.shields.io/badge/paypal-donate-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=M4RKULAVKV7K8)\n[![Twitch](https://img.shields.io/badge/twitch-timXD-6441a5.svg)](http://twitch.tv/timXD)\n\nAs part of the visual improvements featured in iOS 13, `UISegmentedControl` was completely redesigned, featuring a much rounder, cleaner, and slightly more skeuomorphic appearance.\n\n`TOSegmentedControl` is a subclass of of `UIControl` that completely re-implements the look and feel of the new `UISegmentedControl` component, allowing developers to adopt its look even in previous versions of iOS they support.\n\n# Features\n\n* Recreates the new look of `UISegmentedControl`, making it available on previous versions of iOS.\n* Supports both text and images as segment types.\n* Support for `@IBDesignable` and `@IBInspectable`.\n* Configurable to dynamically add or remove items after its creation.\n* Written in Objective-C, but provides full compatibility with Swift.\n* Provides both a block, or `UIControlEvents` to receive when the control is tapped.\n* Light and dark mode support for iOS 13.\n* A reversible mode where tapping the same item twice flips its direction.\n\n# Sample Code\n\n`TOSegmentedControl` has been written to follow the interface of `UISegmentedControl` as closely as possible. This should make it very intuitive to work with.\n\n## Swift\n\nIn Swift, the class is renamed to `SegmentedControl`. Creating a new instance is very similar to `UISegmentedControl`.\n\n```Swift\n\n// Create a new instance\nlet segmentedControl = SegmentedControl(items: [\"First\", \"Second\", \"Third\"])\n\n// Add a closure that will be called each time the selected segment changes\nsegmentedControlsegmentTappedHandler = { segmentIndex, reversed in\n   print(\"Segment \\(segmentIndex) was tapped!\")\n}\n\n// Add a new item to the end\nsegmentedControl.addSegment(withTitle: \"Fourth\")\n\n// Insert a new item at the beginning\nsegmentedControl.insertSegment(withTitle: \"Zero\", at: 0)\n\n// Remove all segments\nsegmentedControl.removeAllSegments()\n\n```\n\n## Objective-C\n\n```objc\n\nNSArray *items = @[@\"First\", @\"Second\", @\"Third\"];\n\n// Create a new instance\nTOSegmentedControl *segmentedControl = [[TOSegmentedControl alloc] initWithItems:items]];\n\n// Add a block that will be called each time the selected segment changes\nsegmentedControl.segmentTappedHandler = ^(NSInteger index, BOOL reversed) {\n    NSLog(@\"Segment %d was tapped!\", index);\n};\n\n// Add a new item to the end\n[segmentedControl addSegmentWithTitle:@\"Fourth\"];\n\n// Insert a new item at the beginning\n[segmentedControl insertSegmentWithTitle:@\"Zero\" atIndex:0];\n\n// Remove all segments\n[segmentedControl removeAllSegments];\n```\n\n\n# System Requirements\niOS 9.0 or above\n\n# Installation\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cstrong\u003eCocoaPods\u003c/strong\u003e\u003c/summary\u003e\n\nAdd the following to your Podfile:\n``` ruby\npod 'TOSegmentedControl'\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cstrong\u003eCarthage\u003c/strong\u003e\u003c/summary\u003e\n\n1. Add the following to your Cartfile:\n``` \ngithub \"TimOliver/TOSegmentedControl\"\n```\n\n2. Run `carthage update`\n\n3. From the `Carthage/Build` folder, import the  `TOSegmentedControl.framework`.\n\n4. Follow the remaining steps on [Getting Started with Carthage](https://github.com/Carthage/Carthage#getting-started) to finish integrating the framework.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eManual Installation\u003c/strong\u003e\u003c/summary\u003e\n\nAll of the necessary source files located in the `TOSegmentedControl` folder. Simply drag that folder into your Xcode project. \n\u003c/details\u003e\n\n# Credits\n\n`TOSegmentedControl` was created by [Tim Oliver](http://twitter.com/TimOliverAU) as a component for [iComics](http://icomics.co).\n\niOS device mockup by [Pixeden](http://www.pixeden.com).\n\n# License\n\n`TOSegmentedControl` is available under the MIT license. Please see the [LICENSE](LICENSE) file for more information. ![analytics](https://ga-beacon.appspot.com/UA-5643664-16/TOSegmentedControl/README.md?pixel)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimoliver%2Ftosegmentedcontrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimoliver%2Ftosegmentedcontrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimoliver%2Ftosegmentedcontrol/lists"}