Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/LeonardoCardoso/SectionedSlider
iOS 11 Control Center Slider
https://github.com/LeonardoCardoso/SectionedSlider
ios library objective-c slider swift ui
Last synced: 3 days ago
JSON representation
iOS 11 Control Center Slider
- Host: GitHub
- URL: https://github.com/LeonardoCardoso/SectionedSlider
- Owner: LeonardoCardoso
- License: mit
- Created: 2017-06-06T12:23:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-16T21:22:28.000Z (over 4 years ago)
- Last Synced: 2024-12-05T16:38:09.639Z (7 days ago)
- Topics: ios, library, objective-c, slider, swift, ui
- Language: Swift
- Homepage: https://leocardz.com/sectionedslider-74270d241d8f
- Size: 1.58 MB
- Stars: 371
- Watchers: 7
- Forks: 27
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - SectionedSlider - Control Center Slider. (UI / Slider)
- awesome-swift - SectionedSlider - Control Center Slider. (Libs / UI)
- awesome-swift - SectionedSlider - Control Center Slider. (UI)
- awesome-swift - SectionedSlider - Control Center Slider. (Libs / UI)
- awesome-ios-star - SectionedSlider - Control Center Slider. (UI / Slider)
- fucking-awesome-swift - SectionedSlider - Control Center Slider. (Libs / UI)
- awesome-swift - SectionedSlider - iOS 11 Control Center Slider ` 📝 3 years ago ` (UI [🔝](#readme))
README
## SectionedSlider
| | |
|:-:|:-:|
| ![iOS](Images/static.gif) | ![watchOS](Images/static2.gif) |[![Platform](https://img.shields.io/badge/platform-iOS-orange.svg)](https://github.com/LeonardoCardoso/SectionedSlider#requirements-and-details)
[![CocoaPods](https://img.shields.io/badge/pod-v0.0.5-red.svg)](https://github.com/LeonardoCardoso/SectionedSlider#cocoapods)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/LeonardoCardoso/SectionedSlider#carthage)> Control Center Slider
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)## Requirements
- iOS 8.0+
- Swift 3.0+
- Xcode 8.0+## Installation
### CocoaPods
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
```bash
$ gem install cocoapods
```> CocoaPods 1.1.0+ is required to build SectionedSlider 0.0.5+.
To integrate SectionedSlider into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!pod 'SectionedSlider', '~> 0.0.5'
```Then, run the following command:
```bash
$ pod install
```### Carthage
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
```bash
$ brew update
$ brew install carthage
```To integrate SectionedSlider into your Xcode project using Carthage, specify it in your `Cartfile`:
```ogdl
github "LeonardoCardoso/SectionedSlider" ~> 0.0.5
```### Manually
If you prefer not to use either of the aforementioned dependency managers, you can integrate SectionedSlider into your project manually.
## Usage
You can use a `SectionedSlider` on [Storyboards](#storyboard) or, if you want to do it programatically, you can create it just like you create a UIView:
```swift
SectionedSlider(
frame: CGRect(x: 0, y: 0, width: 78, height: 200), // Choose a 15.6 / 40 ration for width/height
selectedSection: 3, // Initial selected section
sections: 10 // Number of sections. Choose between 2 and 20
)
```### Palette
You also can customize the colors of the button on its constructor.
```swift
SectionedSlider(
frame: wrapView.frame,
selectedSection: 3,
sections: 10,
palette: Palette(
viewBackgroundColor: UIColor?,
sliderBackgroundColor: UIColor?,
sliderColor: UIColor?
)
)
```![palette](Images/palette.png)
### Delegate
You can watch changes of state by implementing the protocol:
```swift
public protocol SectionedSliderDelegate {
func sectionChanged(slider: SectionedSlider, selected: Int)
}
```### Storyboard
Last but not least, you can customize `SectionedSlider` properties right from Interface Builder or Storyboards.
![storyboard](Images/storyboard.png)
## License
SectionedSlider is released under the MIT license. See [LICENSE](https://github.com/LeonardoCardoso/SectionedSlider/blob/master/LICENSE) for details.