Skip to content

Commit a970155

Browse files
committed
Added README
1 parent cd8c3d0 commit a970155

1 file changed

Lines changed: 82 additions & 1 deletion

File tree

README.md

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,83 @@
11
# TOSegmentedControl
2-
A segmented control in the style of iOS 13 for previous versions of iOS.
2+
3+
![TOSegmentedControl](screenshot.jpg)
4+
5+
[![Build status](https://badge.buildkite.com/f88a3dac71358b8341d9f3bedb2342d2ea765bc0efc7207b48.svg)](https://buildkite.com/xd-ci/tosegmentedcontrol-run-ci)
6+
[![Version](https://img.shields.io/cocoapods/v/TOSegmentedControl.svg?style=flat)](http://cocoadocs.org/docsets/TOSegmentedControl)
7+
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
8+
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/TimOliver/TOSegmentedControl/master/LICENSE)
9+
[![Platform](https://img.shields.io/cocoapods/p/TOSegmentedControl.svg?style=flat)](http://cocoadocs.org/docsets/TOSegmentedControl)
10+
[![PayPal](https://img.shields.io/badge/paypal-donate-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=M4RKULAVKV7K8)
11+
[![Twitch](https://img.shields.io/badge/twitch-timXD-6441a5.svg)](http://twitch.tv/timXD)
12+
13+
As part of the visual overhaul featured in iOS 13, `UISegmentedControl` was completely redesigned, featuring a much rounder, cleaner, and slightly more skeuomorphic appearance.
14+
15+
`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.
16+
17+
# Features
18+
19+
* Recreates the new look of `UISegmentedControl`, making it available on previous versions of iOS.
20+
* Supports both text and images as segment types.
21+
* Configurable to dynamically add or remove items after its creation.
22+
* Written in Objective-C, but provides full compatibility with Swift.
23+
* Provides both a block, or `UIControlEvents` to receive when the control is tapped.
24+
* **(TODO)** A reversible mode where tapping the same item twice flips its direction.
25+
* **(TODO)** Light and dark mode support for iOS 13.
26+
27+
# Sample Code
28+
29+
`TOSegmentedControl` has been written to follow the interface of `UISegmentedControl` as closely as possible. This should make it very intuitive to work with.
30+
31+
```Swift
32+
33+
let segmentedControl = SegmentedControl(items: ["First", "Second", "Third"])
34+
segmentedControlsegmentTappedHandler = { segmentIndex, reversed in
35+
print("Segment \(segmentIndex) was tapped!")
36+
}
37+
```
38+
39+
## System Requirements
40+
iOS 10.0 or above
41+
42+
# Installation
43+
44+
<details>
45+
<summary><strong>CocoaPods</strong></summary>
46+
47+
Add the following to your Podfile:
48+
``` ruby
49+
pod 'TOSegmentedControl'
50+
```
51+
</details>
52+
53+
<details>
54+
<summary><strong>Carthage</strong></summary>
55+
56+
1. Add the following to your Cartfile:
57+
```
58+
github "TimOliver/TOSegmentedControl"
59+
```
60+
61+
2. Run `carthage update`
62+
63+
3. From the `Carthage/Build` folder, import the `TOSegmentedControl.framework`.
64+
65+
4. Follow the remaining steps on [Getting Started with Carthage](https://github.com/Carthage/Carthage#getting-started) to finish integrating the framework.
66+
67+
</details>
68+
69+
<details>
70+
<summary><strong>Manual Installation</strong></summary>
71+
72+
All of the necessary source files located in the `TOSegmentedControl` folder. Simply drag that folder into your Xcode project.
73+
</details>
74+
75+
# Credits
76+
77+
`TOSegmentedControl` was created by [Tim Oliver](http://twitter.com/TimOliverAU) as a component for [iComics](http://icomics.co).
78+
79+
iOS device mockup by [Pixeden](http://www.pixeden.com).
80+
81+
# License
82+
83+
`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)

0 commit comments

Comments
 (0)