34 Commits

Author SHA1 Message Date
Alex K 644d652ae7 swift 4.2 2018-09-27 09:13:51 +03:00
Ramotion c6fd46ce2e Update README.md 2018-06-29 14:26:25 +03:00
Ramotion e1317b3203 Update README.md 2018-06-26 11:13:18 +03:00
Ramotion cac730d7df Update README.md 2018-05-29 11:51:53 +03:00
Ramotion afb8443639 Update README.md 2018-04-26 18:08:44 +03:00
Ramotion 772ead7101 Add files via upload 2018-04-26 08:07:20 -07:00
Ramotion 39ed4afbe3 Update README.md 2018-04-24 09:18:59 +03:00
Ramotion 412de61727 Update README.md 2018-03-12 11:00:06 +03:00
Alex Mikhnev be0361f045 Update README.md 2018-02-21 14:55:37 +03:00
i.kolpachkov 2cac5d0664 remove .DS_Store from index 2018-01-18 13:29:18 +03:00
i.kolpachkov dd0e87e3a1 update .gitignore file 2018-01-18 13:27:00 +03:00
Alex K 4647af5d87 update readme 2017-10-27 09:52:35 +03:00
Alex 8ba2eb261e Merge pull request #22 from hammadzz/swift_4
Swift 4 Support
2017-10-27 09:42:28 +03:00
Hammad 8c14dc8c10 Changed podspec version to 2.1.0 2017-10-26 20:28:25 -04:00
Hammad 762fde2a93 Fixes for Swift 4.0 2017-10-26 20:14:02 -04:00
Travis CI 8de3e7832e reorganize readme 2017-07-28 12:10:43 +03:00
Alex 2257016544 Update README.md 2017-06-27 11:52:16 +03:00
Alex K d6166c1c4e Fixes #19 2017-05-02 14:13:21 +03:00
Juri Vasylenko 388baf9a63 Update README.md 2017-04-05 19:57:37 +03:00
Juri Vasylenko d064819ec0 Update README.md 2017-04-05 19:57:05 +03:00
Juri Vasylenko db38ad1687 Update README.md 2017-04-05 19:56:52 +03:00
Alex Mikhnev 8440de329b Update README.md 2017-03-10 19:55:58 +03:00
Juri Vasylenko ac50a115ae Update README.md 2017-02-17 17:58:41 +03:00
Juri Vasylenko 40afc937cd Update README.md 2017-01-20 16:11:29 +03:00
aleksei1000000 1aaaa3769f Update README.md 2017-01-10 17:13:11 +03:00
Alex.k 791238e402 updated readme 2016-12-14 10:45:49 +03:00
Alex.k ef52d5a09e podspec updated 2016-12-14 10:45:03 +03:00
Alex.k 9c78c75046 fixed bug with position 2016-12-14 10:43:41 +03:00
Alex.k 6d2380f065 updated podspec and readme 2016-12-14 09:48:45 +03:00
Alex.k 2c039420a0 made parentView open 2016-12-14 09:45:43 +03:00
aleksei1000000 9f42265ce4 Update README.md 2016-10-17 10:01:13 +03:00
aleksei1000000 75f7b8b8a6 Update README.md 2016-10-14 14:41:00 +03:00
aleksei1000000 1aca7f9b00 Update README.md 2016-10-14 14:06:39 +03:00
Alex.k 27189bd7e2 updated readme 2016-10-13 14:49:39 +03:00
10 changed files with 158 additions and 63 deletions
+46 -5
View File
@@ -1,6 +1,12 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
@@ -9,18 +15,53 @@ build/
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
xcuserdata/
## Other
*.moved-aside
DerivedData
*.xccheckout
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
*.xcuserstate
*.dSYM.zip
*.dSYM
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
.build/
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
+36 -22
View File
@@ -45,7 +45,11 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
fileprivate var oldState = false
fileprivate var defaultTintColor: UIColor?
fileprivate(set) var parentView: UIView?
@IBOutlet open var parentView: UIView? {
didSet {
defaultTintColor = parentView?.backgroundColor
}
}
// MARK: - Initialization
@@ -68,18 +72,17 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
}
override open func awakeFromNib() {
self.commonInit(superview)
self.commonInit(parentView ?? superview)
super.awakeFromNib()
}
// MARK: Helpers
fileprivate func commonInit(_ parentView: UIView?) {
guard let onTintColor = self.onTintColor else {
fatalError("set tint color")
}
self.parentView = parentView
self.defaultTintColor = parentView?.backgroundColor
defaultTintColor = parentView?.backgroundColor
layer.borderWidth = 0.5
layer.borderColor = UIColor.white.cgColor
@@ -93,43 +96,45 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
showShapeIfNeed()
addTarget(self, action: #selector(RAMPaperSwitch.switchChanged), for: UIControlEvents.valueChanged)
addTarget(self, action: #selector(RAMPaperSwitch.switchChanged), for: UIControl.Event.valueChanged)
}
override open func layoutSubviews() {
let x:CGFloat = max(frame.midX, superview!.frame.size.width - frame.midX);
let y:CGFloat = max(frame.midY, superview!.frame.size.height - frame.midY);
radius = sqrt(x*x + y*y);
if let parentView = self.parentView {
let x:CGFloat = max(center.x, parentView.frame.size.width - frame.midX)
let y:CGFloat = max(center.y, parentView.frame.size.height - frame.midY)
radius = sqrt(x*x + y*y)
}
let additional = parentView == superview ? CGPoint.zero : (superview?.frame.origin ?? CGPoint.zero)
shape.frame = CGRect(x: frame.midX - radius, y: frame.midY - radius, width: radius * 2, height: radius * 2)
shape.anchorPoint = CGPoint(x: 0.5, y: 0.5);
shape.frame = CGRect(x: center.x - radius + additional.x - 2, y: center.y - radius + additional.y, width: radius * 2, height: radius * 2)
shape.anchorPoint = CGPoint(x: 0.5, y: 0.5)
shape.path = UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: radius * 2, height: radius * 2)).cgPath
}
// MARK: - Public
open override func setOn(_ on: Bool, animated: Bool) {
let changed:Bool = on != self.isOn
super.setOn(on, animated: animated)
if changed {
switchChangeWithAniation(animated)
switchChangeWithAnimation(animated)
}
}
// MARK: - Private
fileprivate func showShapeIfNeed() {
shape.transform = isOn ? CATransform3DMakeScale(1.0, 1.0, 1.0) : CATransform3DMakeScale(0.0001, 0.0001, 0.0001)
}
internal func switchChanged() {
switchChangeWithAniation(true)
@objc internal func switchChanged() {
switchChangeWithAnimation(true)
}
// MARK: - Animations
fileprivate func animateKeyPath(_ keyPath: String, fromValue from: CGFloat?, toValue to: CGFloat, timing timingFunction: String) -> CABasicAnimation {
let animation:CABasicAnimation = CABasicAnimation(keyPath: keyPath)
@@ -137,16 +142,16 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
animation.fromValue = from
animation.toValue = to
animation.repeatCount = 1
animation.timingFunction = CAMediaTimingFunction(name: timingFunction)
animation.timingFunction = CAMediaTimingFunction(name: convertToCAMediaTimingFunctionName(timingFunction))
animation.isRemovedOnCompletion = false
animation.fillMode = kCAFillModeForwards
animation.fillMode = CAMediaTimingFillMode.forwards
animation.duration = duration
animation.delegate = self
return animation
}
fileprivate func switchChangeWithAniation(_ animation: Bool) {
fileprivate func switchChangeWithAnimation(_ animation: Bool) {
guard let onTintColor = self.onTintColor else {
return
}
@@ -157,7 +162,7 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
let scaleAnimation:CABasicAnimation = animateKeyPath(Constants.scale,
fromValue: 0.01,
toValue: 1.0,
timing:kCAMediaTimingFunctionEaseIn);
timing:convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn));
if animation == false { scaleAnimation.duration = 0.0001 }
shape.add(scaleAnimation, forKey: Constants.up)
@@ -165,7 +170,7 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
let scaleAnimation:CABasicAnimation = animateKeyPath(Constants.scale,
fromValue: 1.0,
toValue: 0.01,
timing:kCAMediaTimingFunctionEaseOut);
timing:convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeOut));
if animation == false { scaleAnimation.duration = 0.0001 }
shape.add(scaleAnimation, forKey: Constants.down)
@@ -173,7 +178,6 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
}
//MARK: - CAAnimation Delegate
open func animationDidStart(_ anim: CAAnimation) {
parentView?.backgroundColor = defaultTintColor
animationDidStartClosure(isOn)
@@ -187,3 +191,13 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
animationDidStopClosure(isOn, flag)
}
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToCAMediaTimingFunctionName(_ input: String) -> CAMediaTimingFunctionName {
return CAMediaTimingFunctionName(rawValue: input)
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromCAMediaTimingFunctionName(_ input: CAMediaTimingFunctionName) -> String {
return input.rawValue
}
BIN
View File
Binary file not shown.
@@ -260,22 +260,22 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = Ramotion;
TargetAttributes = {
84BE57D11CFF03ED0073C92B = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 34MUF9YXTA;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
};
9C6889F91A274993008BFF1E = {
CreatedOnToolsVersion = 6.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
ProvisioningStyle = Manual;
};
9C688A0E1A274993008BFF1E = {
CreatedOnToolsVersion = 6.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
TestTargetID = 9C6889F91A274993008BFF1E;
};
};
@@ -374,7 +374,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
@@ -390,7 +390,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.PaperSwitch;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
@@ -416,7 +416,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.PaperSwitch;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
@@ -430,14 +430,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -465,7 +473,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -478,14 +486,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -505,7 +521,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
@@ -522,7 +538,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -537,7 +553,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
@@ -557,7 +573,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PaperSwitchDemo.app/PaperSwitchDemo";
};
name = Debug;
@@ -574,7 +590,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PaperSwitchDemo.app/PaperSwitchDemo";
};
name = Release;
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}
}
@@ -57,13 +57,13 @@ class ViewController: UIViewController {
}
fileprivate func animateLabel(_ label: UILabel, onAnimation: Bool, duration: TimeInterval) {
UIView.transition(with: label, duration: duration, options: UIViewAnimationOptions.transitionCrossDissolve, animations: {
UIView.transition(with: label, duration: duration, options: UIView.AnimationOptions.transitionCrossDissolve, animations: {
label.textColor = onAnimation ? UIColor.white : UIColor(red: 31/255.0, green: 183/255.0, blue: 252/255.0, alpha: 1)
}, completion:nil)
}
fileprivate func animateImageView(_ imageView: UIImageView, onAnimation: Bool, duration: TimeInterval) {
UIView.transition(with: imageView, duration: duration, options: UIViewAnimationOptions.transitionCrossDissolve, animations: {
UIView.transition(with: imageView, duration: duration, options: UIView.AnimationOptions.transitionCrossDissolve, animations: {
imageView.image = UIImage(named: onAnimation ? "img_phone_on" : "img_phone_off")
}, completion:nil)
}
+2 -2
View File
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = 'RAMPaperSwitch'
s.version = '2.0.0'
s.version = '3.0.0'
s.summary = 'Swift subclass of the UISwitch which paints over the parent view'
s.homepage = 'https://github.com/Ramotion/paper-switch'
s.license = 'MIT'
s.author = { 'juri.v' => 'juri.v@ramotion.com' }
s.source = { :git => 'https://github.com/Ramotion/paper-switch.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.ios.deployment_target = '9.0'
s.source_files = 'PaperSwitch/*.swift'
end
+41 -17
View File
@@ -1,37 +1,47 @@
[![header](https://raw.githubusercontent.com/Ramotion/paper-switch/master/header.png)](https://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch-logo)
#RAMPaperSwitch
[![header](./header.png)](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch-logo)
<img src="https://github.com/Ramotion/paper-switch/blob/master/paper-switch.gif" width="600" height="450" />
<br><br/>
# RAMPaperSwitch
[![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/Twitter-@Ramotion-blue.svg?style=flat)](http://twitter.com/Ramotion)
[![Travis](https://img.shields.io/travis/Ramotion/paper-switch.svg)](https://travis-ci.org/Ramotion/paper-switch)
[![Analytics](https://ga-beacon.appspot.com/UA-84973210-1/ramotion/paper-switch)](https://github.com/igrigorik/ga-beacon)
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/Ramotion)
## About
This project is maintained by Ramotion, an agency specialized in building dedicated engineering teams and developing custom software.<br><br> [Contact our team](https://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch-contact-us) and well help you work with the best engineers from Eastern Europe.
This project is maintained by Ramotion, Inc.<br>
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.<br>
**Looking for developers for your project?**<br>
This project is maintained by Ramotion, Inc. We specialize in the designing and coding of custom UI for Mobile Apps and Websites.
#Screenshot
[![PaperSwitch](https://raw.githubusercontent.com/Ramotion/paper-switch/master/screenshot.gif)](https://dribbble.com/shots/1749645-Contact-Sync)
<a href="mailto:alex.a@ramotion.com?subject=Project%20inquiry%20from%20Github">
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a> <br>
The [iPhone mockup](https://store.ramotion.com/product/iphone-6-plus-mockups?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch) available [here](https://store.ramotion.com/product/iphone-6-plus-mockups?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch).
The [iPhone mockup](https://store.ramotion.com/product/iphone-x-clay-mockups?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch).
## Try this UI control in action
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=gthb-paper-switch&mt=8" > <img src="https://github.com/Ramotion/navigation-stack/raw/master/Download_on_the_App_Store_Badge_US-UK_135x40.png" width="170" height="58"></a>
## Requirements
- iOS 8.0+
- Xcode 6.1
- Xcode 9.0+
#Installation
# Installation
Just add the `RAMPaperSwitch` folder to your project.
or use [CocoaPods](https://cocoapods.org) with Podfile:
``` ruby
pod 'RAMPaperSwitch', '~> 1.0.7' swift 2.2
pod 'RAMPaperSwitch', '~> 2.0.0' swift 3
pod 'RAMPaperSwitch'
```
or [Carthage](https://github.com/Carthage/Carthage) users can simply add to their `Cartfile`:
```
@@ -39,7 +49,7 @@ github "Ramotion/paper-switch"
```
#Usage
# 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.
@@ -54,7 +64,7 @@ You have ability to set duration of animation instead of default value.
5. Add animation for other views near the switch if need.
#Animate views
# 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
@@ -65,7 +75,21 @@ self.paperSwitch.animationDidStartClosure = {(onAnimation: Bool) in
}
```
## Folow Us
<br>
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=https://github.com/ramotion/paper-switch)
[![Twitter Follow](https://img.shields.io/twitter/follow/ramotion.svg?style=social)](https://twitter.com/ramotion)
This library is a part of a <a href="https://github.com/Ramotion/swift-ui-animation-components-and-libraries"><b>selection of our best UI open-source projects.</b></a>
# 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.
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=paper-switch&mt=8" >
<img src="https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png" width="117" height="34"></a>
<a href="mailto:alex.a@ramotion.com?subject=Project%20inquiry%20from%20Github">
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
<br>
<br>
Follow us for the latest updates<br>
<a href="https://goo.gl/rPFpid" >
<img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB