Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Ramotion/paper-switch
:octocat: 🎚 RAMPaperSwitch is a Swift material design UI module which paints over the parent view when the switch is turned on. iOS library by @Ramotion
https://github.com/Ramotion/paper-switch
component ios library swift
Last synced: 3 days ago
JSON representation
:octocat: 🎚 RAMPaperSwitch is a Swift material design UI module which paints over the parent view when the switch is turned on. iOS library by @Ramotion
- Host: GitHub
- URL: https://github.com/Ramotion/paper-switch
- Owner: Ramotion
- License: mit
- Created: 2014-11-26T09:26:50.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-01-25T19:02:51.000Z (almost 3 years ago)
- Last Synced: 2024-10-29T15:34:08.313Z (about 1 month ago)
- Topics: component, ios, library, swift
- Language: Swift
- Homepage: https://www.ramotion.com/paper-switch/
- Size: 3.52 MB
- Stars: 2,931
- Watchers: 81
- Forks: 230
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - RAMPaperSwitch - RAMPaperSwitch is a Swift module which paints over the parent view when the switch is turned on. (UI / Switch)
- awesome-swift - paper-switch - RAMPaperSwitch is a material design UI module which paints over the parent view when the switch is turned on. (Libs / UI)
- awesome-swift - paper-switch - RAMPaperSwitch is a material design UI module which paints over the parent view when the switch is turned on. (Libs / UI)
- awesome-material-design - paper-switch - Material switch component that changes the background as well (iOS / Components)
- awesome-ios-star - RAMPaperSwitch - RAMPaperSwitch is a Swift module which paints over the parent view when the switch is turned on. (UI / Switch)
- awesome-ios - RAMPaperSwitch - Swift material design UI module which paints over the parent view when the switch is turned on. iOS library. [•](https://raw.githubusercontent.com/Ramotion/paper-switch/master/paper-switch.gif) (Content / Switch)
- fucking-awesome-swift - paper-switch - RAMPaperSwitch is a material design UI module which paints over the parent view when the switch is turned on. (Libs / UI)
- awesome-swift-lib-hunt - RAMPaperSwitch - Awesome animation switch library but its installation guide is not enough. Need to check their example, NOT recommended for new iOS Developers (UI)
- awesome-swift-lib-hunt - RAMPaperSwitch - Awesome animation switch library but its installation guide is not enough. Need to check their example, NOT recommended for new iOS Developers (UI)
- awesome-swift - paper-switch - RAMPaperSwitch is a Swift material design UI module which paints over the parent view when the switch is turned on. iOS library by @Ramotion ` 📝 a year ago` (UI [🔝](#readme))
README
PAPER SWITCH
A Swift material design UI module which paints over the parent view when the switch is on.
___
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.
Stay tuned for the latest updates:
[![CocoaPods](https://img.shields.io/cocoapods/p/RAMPaperSwitch.svg)](https://cocoapods.org/pods/RAMPaperSwitch)
[![CocoaPods](https://img.shields.io/cocoapods/v/RAMPaperSwitch.svg)](http://cocoapods.org/pods/RAMPaperSwitch)
[![CocoaPods](https://img.shields.io/cocoapods/metrics/doc-percent/RAMPaperSwitch.svg)](https://cdn.rawgit.com/Ramotion/paper-switch/master/docs/index.html)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Ramotion/paper-switch)
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat)](http://twitter.com/Ramotion)
[![Travis](https://img.shields.io/travis/Ramotion/paper-switch.svg)](https://travis-ci.org/Ramotion/paper-switch)
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/Ramotion)## Requirements
- iOS 8.0+
- Xcode 9.0+# Installation
Just add the `RAMPaperSwitch` folder to your project.
or use [CocoaPods](https://cocoapods.org) with Podfile:
``` ruby
pod 'RAMPaperSwitch'
```
or [Carthage](https://github.com/Carthage/Carthage) users can simply add to their `Cartfile`:
```
github "Ramotion/paper-switch"
```# Usage
RAMPaperSwitch is a drop-in replacement of UISwitch. You just need to set the `onTintColor` property of the switch, and it will automatically _paint over_ its superview with the selected color.
You have ability to set duration of animation instead of default value.1. Create a new UISwitch in your storyboard or nib.
2. Set the class of the UISwitch to RAMPaperSwitch in your Storyboard or nib.
3. Set `onTintColor` for the switch
4. Set `duration` property programmatically if You want to change animation duration.
5. Add animation for other views near the switch if need.
# Animate views
You can animate other views near the switch. For example, you can change color to views or labels that are inside the same superview. Duration of animation can be gotten from the RAMPaperSwitch's property `duration`. You can animate CoreAnimation properties like this:``` swift
self.paperSwitch.animationDidStartClosure = {(onAnimation: Bool) in
UIView.transitionWithView(self.label, duration: self.paperSwitch.duration, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: {
self.label.textColor = onAnimation ? UIColor.whiteColor() : UIColor.blueColor()
}, completion:nil)
}
```
## 📄 License
Paper Switch is released under the MIT license.
See [LICENSE](./LICENSE) for details.This library is a part of a selection of our best UI open-source projects.
If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com
## 📱 Get the Showroom App for iOS to give it a try
Try this UI component and more like this in our iOS app. Contact us if interested.