28 Commits

Author SHA1 Message Date
Alex.k 78f2d7077d update docs 2016-06-10 11:06:06 +03:00
Alex.k dc804d1f2a update readme 2016-06-07 12:15:11 +03:00
Alex.k 690315178b update readme 2016-06-07 12:10:32 +03:00
Alex.k b521e21851 added docs 2016-06-07 12:06:37 +03:00
Alex 72c3ed1e37 Update README.md 2016-06-02 16:36:31 +03:00
Alex.k 4dd0ef0342 update readme 2016-06-01 17:19:09 +03:00
Alex.k 693e5d0645 update readme 2016-06-01 17:16:32 +03:00
Alex.k d97f564422 update podspec 2016-06-01 16:58:04 +03:00
Alex.k 58e2424f91 fixed crash 2016-06-01 16:55:54 +03:00
Alex.k c4602436d1 shared scheme 2016-06-01 14:59:25 +03:00
Alex.k 3c736ff8c0 update pods 2016-05-31 12:52:03 +03:00
Alex.k 9c8d992237 Fixes #14 2016-05-31 12:48:46 +03:00
Alex.k e43d214be4 update podspec 2016-05-30 15:42:40 +03:00
Alex.k 7e010e5a0a Fixes #14 2016-05-30 14:47:22 +03:00
Alex 36d563d17b Update README.md 2016-03-23 09:44:48 +03:00
Alex.k 0b96f702e1 update podspec 2016-03-23 09:37:18 +03:00
Alex.k eedba1996f Fixed #13 2016-03-23 09:36:02 +03:00
Alex af5929b834 Update README.md 2016-03-14 09:35:49 +03:00
Alex.k d732302363 update podspec 2016-03-14 09:29:05 +03:00
Alex dc86cd2b03 Merge pull request #11 from joeblau/master
Make class public so it's accessable programmatically without Storyboards
2016-03-14 09:26:02 +03:00
Joe Blau 7b1159d718 Added color support on initialization 2016-03-13 13:49:20 -04:00
Joe Blau 3fcee77c2e Added view based initialization 2016-03-13 13:22:53 -04:00
Joe Blau 5b3d07a65f Make class public so it's accessable programmatically without Storyboards 2016-03-13 12:05:06 -04:00
Juri Vasylenko ef935a478c fixed typo in header.png name 2016-02-15 11:37:47 +03:00
Juri Vasylenko 865d501bca add header 2016-02-15 11:36:14 +03:00
Juri Vasylenko c866fb10f3 Update README.md 2016-02-01 12:14:12 +03:00
Juri Vasylenko 839fb5e072 Update README.md 2016-02-01 12:13:51 +03:00
Juri Vasylenko f3d5182872 Merge pull request #9 from Ramotion/docs_update
Docs update
2016-02-01 10:06:24 +03:00
35 changed files with 2438 additions and 178 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
osx_image: xcode7.2
osx_image: xcode7.3
language: objective-c
xcode_project: PaperSwitchDemo/PaperSwitchDemo.xcodeproj
xcode_scheme: PaperSwitchDemo
xcode_scheme: PaperSwitch
xcode_sdk: iphonesimulator
+173 -129
View File
@@ -22,137 +22,181 @@
import UIKit
class RAMPaperSwitch: UISwitch {
@IBInspectable var duration: Double = 0.35
var animationDidStartClosure = {(onAnimation: Bool) -> Void in }
var animationDidStopClosure = {(onAnimation: Bool, finished: Bool) -> Void in }
private var shape: CAShapeLayer! = CAShapeLayer()
private var radius: CGFloat = 0.0
private var oldState = false
/// Swift subclass of the UISwitch which paints over the parent view with the onTintColor when the switch is turned on.
public class RAMPaperSwitch: UISwitch {
override var on: Bool {
didSet(oldValue) {
oldState = on
}
}
struct Constants {
static let scale = "transform.scale"
static let up = "scaleUp"
static let down = "scaleDown"
}
override func setOn(on: Bool, animated: Bool) {
let changed:Bool = on != self.on
super.setOn(on, animated: animated)
if changed {
if animated {
switchChanged()
} else {
showShapeIfNeed()
}
}
}
override 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);
shape.frame = CGRectMake(frame.midX - radius, frame.midY - radius, radius * 2, radius * 2)
shape.anchorPoint = CGPointMake(0.5, 0.5);
shape.path = UIBezierPath(ovalInRect: CGRectMake(0, 0, radius * 2, radius * 2)).CGPath
}
override func awakeFromNib() {
let shapeColor: UIColor = onTintColor ?? UIColor.greenColor()
layer.borderWidth = 0.5
layer.borderColor = UIColor.whiteColor().CGColor;
layer.cornerRadius = frame.size.height / 2;
shape.fillColor = shapeColor.CGColor
shape.masksToBounds = true
superview?.layer.insertSublayer(shape, atIndex: 0)
superview?.layer.masksToBounds = true
showShapeIfNeed()
addTarget(self, action: "switchChanged", forControlEvents: UIControlEvents.ValueChanged)
super.awakeFromNib()
}
/// The total duration of the animations, measured in seconds. Default 0.35
@IBInspectable public var duration: Double = 0.35
private func showShapeIfNeed() {
shape.transform = on ? CATransform3DMakeScale(1.0, 1.0, 1.0) : CATransform3DMakeScale(0.0001, 0.0001, 0.0001)
}
/// Closuer call when animation start
public var animationDidStartClosure = {(onAnimation: Bool) -> Void in }
/// Closuer call when animation finish
public var animationDidStopClosure = {(onAnimation: Bool, finished: Bool) -> Void in }
private var shape: CAShapeLayer! = CAShapeLayer()
private var radius: CGFloat = 0.0
private var oldState = false
internal func switchChanged() {
if on == oldState {
return;
}
oldState = on
if on {
CATransaction.begin()
shape.removeAnimationForKey("scaleDown")
let scaleAnimation:CABasicAnimation = animateKeyPath("transform",
fromValue: NSValue(CATransform3D: CATransform3DMakeScale(0.0001, 0.0001, 0.0001)),
toValue:NSValue(CATransform3D: CATransform3DMakeScale(1.0, 1.0, 1.0)),
timing:kCAMediaTimingFunctionEaseIn);
shape.addAnimation(scaleAnimation, forKey: "scaleUp")
CATransaction.commit();
}
else {
CATransaction.begin()
shape.removeAnimationForKey("scaleUp")
let scaleAnimation:CABasicAnimation = animateKeyPath("transform",
fromValue: NSValue(CATransform3D: CATransform3DMakeScale(1.0, 1.0, 1.0)),
toValue:NSValue(CATransform3D: CATransform3DMakeScale(0.0001, 0.0001, 0.0001)),
timing:kCAMediaTimingFunctionEaseOut);
shape.addAnimation(scaleAnimation, forKey: "scaleDown")
CATransaction.commit();
}
}
private func animateKeyPath(keyPath: String, fromValue from: AnyObject, toValue to: AnyObject, timing timingFunction: String) -> CABasicAnimation {
let animation:CABasicAnimation = CABasicAnimation(keyPath: keyPath)
animation.fromValue = from
animation.toValue = to
animation.repeatCount = 1
animation.timingFunction = CAMediaTimingFunction(name: timingFunction)
animation.removedOnCompletion = false
animation.fillMode = kCAFillModeForwards
animation.duration = duration;
animation.delegate = self
return animation;
}
//CAAnimation delegate
override func animationDidStart(anim: CAAnimation){
animationDidStartClosure(on)
}
override func animationDidStop(anim: CAAnimation, finished flag: Bool){
animationDidStopClosure(on, flag)
}
private var defaultTintColor: UIColor?
private var parentView: UIView?
// MARK: - Initialization
/**
Returns an initialized switch object.
- parameter view: animatable view
- parameter color: The color which fill view.
- returns: An initialized UISwitch object.
*/
public required init(view: UIView?, color: UIColor?) {
super.init(frame: CGRectZero)
onTintColor = color
self.commonInit(view)
}
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override public func awakeFromNib() {
self.commonInit(superview)
super.awakeFromNib()
}
}
// MARK: public
public extension RAMPaperSwitch {
override public func setOn(on: Bool, animated: Bool) {
let changed:Bool = on != self.on
super.setOn(on, animated: animated)
if changed {
switchChangeWithAniatiom(animated)
}
}
}
// MARK: Helpers
extension RAMPaperSwitch {
private func commonInit(parentView: UIView?) {
guard let onTintColor = self.onTintColor else {
fatalError("set tint color")
}
self.parentView = parentView
self.defaultTintColor = parentView?.backgroundColor
layer.borderWidth = 0.5
layer.borderColor = UIColor.whiteColor().CGColor;
layer.cornerRadius = frame.size.height / 2;
shape.fillColor = onTintColor.CGColor
shape.masksToBounds = true
parentView?.layer.insertSublayer(shape, atIndex: 0)
parentView?.layer.masksToBounds = true
showShapeIfNeed()
addTarget(self, action: #selector(RAMPaperSwitch.switchChanged), forControlEvents: UIControlEvents.ValueChanged)
}
override public 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);
shape.frame = CGRectMake(frame.midX - radius, frame.midY - radius, radius * 2, radius * 2)
shape.anchorPoint = CGPointMake(0.5, 0.5);
shape.path = UIBezierPath(ovalInRect: CGRectMake(0, 0, radius * 2, radius * 2)).CGPath
}
// MARK: - Private
private func showShapeIfNeed() {
shape.transform = on ? CATransform3DMakeScale(1.0, 1.0, 1.0) : CATransform3DMakeScale(0.0001, 0.0001, 0.0001)
}
internal func switchChanged() {
switchChangeWithAniatiom(true)
}
}
// MARK: animations
extension RAMPaperSwitch {
private func animateKeyPath(keyPath: String, fromValue from: CGFloat?, toValue to: CGFloat, timing timingFunction: String) -> CABasicAnimation {
let animation:CABasicAnimation = CABasicAnimation(keyPath: keyPath)
animation.fromValue = from
animation.toValue = to
animation.repeatCount = 1
animation.timingFunction = CAMediaTimingFunction(name: timingFunction)
animation.removedOnCompletion = false
animation.fillMode = kCAFillModeForwards
animation.duration = duration;
animation.delegate = self
return animation;
}
private func switchChangeWithAniatiom(animation: Bool) {
guard let onTintColor = self.onTintColor else {
return
}
shape.fillColor = onTintColor.CGColor
if on {
let scaleAnimation:CABasicAnimation = animateKeyPath(Constants.scale,
fromValue: 0.01,
toValue: 1.0,
timing:kCAMediaTimingFunctionEaseIn);
if animation == false { scaleAnimation.duration = 0.0001 }
shape.addAnimation(scaleAnimation, forKey: Constants.up)
}
else {
let scaleAnimation:CABasicAnimation = animateKeyPath(Constants.scale,
fromValue: 1.0,
toValue: 0.01,
timing:kCAMediaTimingFunctionEaseOut);
if animation == false { scaleAnimation.duration = 0.0001 }
shape.addAnimation(scaleAnimation, forKey: Constants.down)
}
}
//MARK: - CAAnimation Delegate
override public func animationDidStart(anim: CAAnimation){
parentView?.backgroundColor = defaultTintColor
animationDidStartClosure(on)
}
override public func animationDidStop(anim: CAAnimation, finished flag: Bool){
print(flag)
if flag == true {
parentView?.backgroundColor = on == true ? onTintColor : defaultTintColor
}
animationDidStopClosure(on, flag)
}
}
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
+19
View File
@@ -0,0 +1,19 @@
//
// PaperSwitch.h
// PaperSwitch
//
// Created by Alex K. on 01/06/16.
// Copyright © 2016 Ramotion. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for PaperSwitch.
FOUNDATION_EXPORT double PaperSwitchVersionNumber;
//! Project version string for PaperSwitch.
FOUNDATION_EXPORT const unsigned char PaperSwitchVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <PaperSwitch/PublicHeader.h>
@@ -8,6 +8,10 @@
/* Begin PBXBuildFile section */
846E0ED31C464B5C0052CDD8 /* Launch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 846E0ED21C464B5C0052CDD8 /* Launch.storyboard */; };
84BE57D51CFF03ED0073C92B /* PaperSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 84BE57D41CFF03ED0073C92B /* PaperSwitch.h */; settings = {ATTRIBUTES = (Public, ); }; };
84BE57D91CFF03ED0073C92B /* PaperSwitch.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84BE57D21CFF03ED0073C92B /* PaperSwitch.framework */; };
84BE57DA1CFF03ED0073C92B /* PaperSwitch.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 84BE57D21CFF03ED0073C92B /* PaperSwitch.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
84BE57DF1CFF04000073C92B /* RAMPaperSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C688A221A274A39008BFF1E /* RAMPaperSwitch.swift */; };
9C688A001A274993008BFF1E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C6889FF1A274993008BFF1E /* AppDelegate.swift */; };
9C688A021A274993008BFF1E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C688A011A274993008BFF1E /* ViewController.swift */; };
9C688A071A274993008BFF1E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9C688A061A274993008BFF1E /* Images.xcassets */; };
@@ -17,6 +21,13 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
84BE57D71CFF03ED0073C92B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 9C6889F21A274993008BFF1E /* Project object */;
proxyType = 1;
remoteGlobalIDString = 84BE57D11CFF03ED0073C92B;
remoteInfo = PaperSwitch;
};
9C688A101A274993008BFF1E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 9C6889F21A274993008BFF1E /* Project object */;
@@ -26,8 +37,25 @@
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
84BE57DE1CFF03ED0073C92B /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
84BE57DA1CFF03ED0073C92B /* PaperSwitch.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
846E0ED21C464B5C0052CDD8 /* Launch.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Launch.storyboard; sourceTree = "<group>"; };
84BE57D21CFF03ED0073C92B /* PaperSwitch.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PaperSwitch.framework; sourceTree = BUILT_PRODUCTS_DIR; };
84BE57D41CFF03ED0073C92B /* PaperSwitch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaperSwitch.h; sourceTree = "<group>"; };
84BE57D61CFF03ED0073C92B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9C6889FA1A274993008BFF1E /* PaperSwitchDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PaperSwitchDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
9C6889FE1A274993008BFF1E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9C6889FF1A274993008BFF1E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -41,10 +69,18 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
84BE57CE1CFF03ED0073C92B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
9C6889F71A274993008BFF1E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
84BE57D91CFF03ED0073C92B /* PaperSwitch.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -58,11 +94,21 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
84BE57D31CFF03ED0073C92B /* PaperSwitch */ = {
isa = PBXGroup;
children = (
84BE57D41CFF03ED0073C92B /* PaperSwitch.h */,
84BE57D61CFF03ED0073C92B /* Info.plist */,
);
path = PaperSwitch;
sourceTree = "<group>";
};
9C6889F11A274993008BFF1E = {
isa = PBXGroup;
children = (
9C6889FC1A274993008BFF1E /* PaperSwitchDemo */,
9C688A121A274993008BFF1E /* PaperSwitchDemoTests */,
84BE57D31CFF03ED0073C92B /* PaperSwitch */,
9C6889FB1A274993008BFF1E /* Products */,
);
sourceTree = "<group>";
@@ -72,6 +118,7 @@
children = (
9C6889FA1A274993008BFF1E /* PaperSwitchDemo.app */,
9C688A0F1A274993008BFF1E /* PaperSwitchDemoTests.xctest */,
84BE57D21CFF03ED0073C92B /* PaperSwitch.framework */,
);
name = Products;
sourceTree = "<group>";
@@ -126,7 +173,36 @@
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
84BE57CF1CFF03ED0073C92B /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
84BE57D51CFF03ED0073C92B /* PaperSwitch.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
84BE57D11CFF03ED0073C92B /* PaperSwitch */ = {
isa = PBXNativeTarget;
buildConfigurationList = 84BE57DD1CFF03ED0073C92B /* Build configuration list for PBXNativeTarget "PaperSwitch" */;
buildPhases = (
84BE57CD1CFF03ED0073C92B /* Sources */,
84BE57CE1CFF03ED0073C92B /* Frameworks */,
84BE57CF1CFF03ED0073C92B /* Headers */,
84BE57D01CFF03ED0073C92B /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = PaperSwitch;
productName = PaperSwitch;
productReference = 84BE57D21CFF03ED0073C92B /* PaperSwitch.framework */;
productType = "com.apple.product-type.framework";
};
9C6889F91A274993008BFF1E /* PaperSwitchDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 9C688A191A274993008BFF1E /* Build configuration list for PBXNativeTarget "PaperSwitchDemo" */;
@@ -134,10 +210,12 @@
9C6889F61A274993008BFF1E /* Sources */,
9C6889F71A274993008BFF1E /* Frameworks */,
9C6889F81A274993008BFF1E /* Resources */,
84BE57DE1CFF03ED0073C92B /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
84BE57D81CFF03ED0073C92B /* PBXTargetDependency */,
);
name = PaperSwitchDemo;
productName = PaperSwitchDemo;
@@ -173,6 +251,9 @@
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = Ramotion;
TargetAttributes = {
84BE57D11CFF03ED0073C92B = {
CreatedOnToolsVersion = 7.3.1;
};
9C6889F91A274993008BFF1E = {
CreatedOnToolsVersion = 6.1;
};
@@ -197,11 +278,19 @@
targets = (
9C6889F91A274993008BFF1E /* PaperSwitchDemo */,
9C688A0E1A274993008BFF1E /* PaperSwitchDemoTests */,
84BE57D11CFF03ED0073C92B /* PaperSwitch */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
84BE57D01CFF03ED0073C92B /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
9C6889F81A274993008BFF1E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -222,6 +311,14 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
84BE57CD1CFF03ED0073C92B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
84BE57DF1CFF04000073C92B /* RAMPaperSwitch.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
9C6889F61A274993008BFF1E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -243,6 +340,11 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
84BE57D81CFF03ED0073C92B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 84BE57D11CFF03ED0073C92B /* PaperSwitch */;
targetProxy = 84BE57D71CFF03ED0073C92B /* PBXContainerItemProxy */;
};
9C688A111A274993008BFF1E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 9C6889F91A274993008BFF1E /* PaperSwitchDemo */;
@@ -251,6 +353,53 @@
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
84BE57DB1CFF03ED0073C92B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = PaperSwitch/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.PaperSwitch;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
84BE57DC1CFF03ED0073C92B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = PaperSwitch/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.PaperSwitch;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
9C688A171A274993008BFF1E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -335,6 +484,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = PaperSwitchDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -347,6 +497,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = PaperSwitchDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -394,6 +545,14 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
84BE57DD1CFF03ED0073C92B /* Build configuration list for PBXNativeTarget "PaperSwitch" */ = {
isa = XCConfigurationList;
buildConfigurations = (
84BE57DB1CFF03ED0073C92B /* Debug */,
84BE57DC1CFF03ED0073C92B /* Release */,
);
defaultConfigurationIsVisible = 0;
};
9C6889F51A274993008BFF1E /* Build configuration list for PBXProject "PaperSwitchDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -14,9 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9C6889F91A274993008BFF1E"
BuildableName = "PaperSwitchDemo.app"
BlueprintName = "PaperSwitchDemo"
BlueprintIdentifier = "84BE57D11CFF03ED0073C92B"
BuildableName = "PaperSwitch.framework"
BlueprintName = "PaperSwitch"
ReferencedContainer = "container:PaperSwitchDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@@ -28,26 +28,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9C688A0E1A274993008BFF1E"
BuildableName = "PaperSwitchDemoTests.xctest"
BlueprintName = "PaperSwitchDemoTests"
ReferencedContainer = "container:PaperSwitchDemo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9C6889F91A274993008BFF1E"
BuildableName = "PaperSwitchDemo.app"
BlueprintName = "PaperSwitchDemo"
ReferencedContainer = "container:PaperSwitchDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
@@ -61,16 +42,15 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9C6889F91A274993008BFF1E"
BuildableName = "PaperSwitchDemo.app"
BlueprintName = "PaperSwitchDemo"
BlueprintIdentifier = "84BE57D11CFF03ED0073C92B"
BuildableName = "PaperSwitch.framework"
BlueprintName = "PaperSwitch"
ReferencedContainer = "container:PaperSwitchDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
@@ -80,16 +60,15 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9C6889F91A274993008BFF1E"
BuildableName = "PaperSwitchDemo.app"
BlueprintName = "PaperSwitchDemo"
BlueprintIdentifier = "84BE57D11CFF03ED0073C92B"
BuildableName = "PaperSwitch.framework"
BlueprintName = "PaperSwitch"
ReferencedContainer = "container:PaperSwitchDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ViewController" customModule="PaperSwitchDemo" customModuleProvider="target">
+1 -1
View File
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = 'RAMPaperSwitch'
s.version = '0.0.1'
s.version = '1.0.4'
s.summary = 'Swift subclass of the UISwitch which paints over the parent view'
s.homepage = 'https://github.com/Ramotion/paper-switch'
s.license = 'MIT'
+12 -9
View File
@@ -1,15 +1,17 @@
![header](https://raw.githubusercontent.com/Ramotion/paper-switch/master/header.png)
#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)
[![Swift 2.1](https://img.shields.io/badge/Swift-2.1-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![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)
Swift subclass of the UISwitch which paints over the parent view with the `onTintColor` when the switch is turned on. Implemented concept from [this Dribbble](https://dribbble.com/shots/1749645-Contact-Sync) shot by [Ramotion](http://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch).
Swift subclass of the UISwitch which paints over the parent view with the `onTintColor` when the switch is turned on. Implemented concept from [this Dribbble](https://dribbble.com/shots/1749645-Contact-Sync) shot by [Ramotion](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch).
#Screenshot
![PaperSwitch](screenshot.gif)
![PaperSwitch](https://raw.githubusercontent.com/Ramotion/paper-switch/master/screenshot.gif)
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).
@@ -26,7 +28,11 @@ Just add the `RAMPaperSwitch` folder to your project.
or use [CocoaPods](https://cocoapods.org) with Podfile:
``` ruby
pod 'RAMPaperSwitch', '~> 0.0.1'
pod 'RAMPaperSwitch'
```
or [Carthage](https://github.com/Carthage/Carthage) users can simply add to their `Cartfile`:
```
github "Ramotion/paper-switch"
```
@@ -57,11 +63,8 @@ self.paperSwitch.animationDidStartClosure = {(onAnimation: Bool) in
```
## About
The project maintained by [app development agency](http://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch) [Ramotion Inc.](http://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch)
See our other [open-source projects](https://github.com/ramotion) or [hire](http://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch) us to design, develop, and grow your product.
The project maintained by [app development agency](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch) [Ramotion Inc.](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch)
See our other [open-source projects](https://github.com/ramotion) or [hire](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch) us to design, develop, and grow your product.
[![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)
+89
View File
@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Classes Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">PaperSwitchDemo Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">PaperSwitchDemo Reference</a>
<img id="carat" src="img/carat.png" />
Classes Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/RAMPaperSwitch.html">RAMPaperSwitch</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Classes</h1>
<p>The following classes are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:C15PaperSwitchDemo14RAMPaperSwitch"></a>
<a name="//apple_ref/swift/Class/RAMPaperSwitch" class="dashAnchor"></a>
<a class="token" href="#/s:C15PaperSwitchDemo14RAMPaperSwitch">RAMPaperSwitch</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Swift subclass of the UISwitch which paints over the parent view with the onTintColor when the switch is turned on.</p>
<a href="Classes/RAMPaperSwitch.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">RAMPaperSwitch</span><span class="p">:</span> <span class="kt">UISwitch</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
+225
View File
@@ -0,0 +1,225 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>RAMPaperSwitch Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/RAMPaperSwitch" class="dashAnchor"></a>
<a title="RAMPaperSwitch Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">PaperSwitchDemo Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">PaperSwitchDemo Reference</a>
<img id="carat" src="../img/carat.png" />
RAMPaperSwitch Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/RAMPaperSwitch.html">RAMPaperSwitch</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>RAMPaperSwitch</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">RAMPaperSwitch</span><span class="p">:</span> <span class="kt">UISwitch</span></code></pre>
</div>
</div>
<p>Swift subclass of the UISwitch which paints over the parent view with the onTintColor when the switch is turned on.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vC15PaperSwitchDemo14RAMPaperSwitch8durationSd"></a>
<a name="//apple_ref/swift/Property/duration" class="dashAnchor"></a>
<a class="token" href="#/s:vC15PaperSwitchDemo14RAMPaperSwitch8durationSd">duration</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The total duration of the animations, measured in seconds. Default 0.35</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">@IBInspectable</span> <span class="kd">public</span> <span class="k">var</span> <span class="nv">duration</span><span class="p">:</span> <span class="kt">Double</span> <span class="o">=</span> <span class="mf">0.35</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vC15PaperSwitchDemo14RAMPaperSwitch24animationDidStartClosureFSbT_"></a>
<a name="//apple_ref/swift/Property/animationDidStartClosure" class="dashAnchor"></a>
<a class="token" href="#/s:vC15PaperSwitchDemo14RAMPaperSwitch24animationDidStartClosureFSbT_">animationDidStartClosure</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Closuer call when animation start</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">animationDidStartClosure</span> <span class="o">=</span> <span class="p">{(</span><span class="nv">onAnimation</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span> <span class="k">in</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vC15PaperSwitchDemo14RAMPaperSwitch23animationDidStopClosureFTSbSb_T_"></a>
<a name="//apple_ref/swift/Property/animationDidStopClosure" class="dashAnchor"></a>
<a class="token" href="#/s:vC15PaperSwitchDemo14RAMPaperSwitch23animationDidStopClosureFTSbSb_T_">animationDidStopClosure</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Closuer call when animation finish</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">animationDidStopClosure</span> <span class="o">=</span> <span class="p">{(</span><span class="nv">onAnimation</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">,</span> <span class="nv">finished</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span> <span class="k">in</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Initialization"></a>
<a name="//apple_ref/swift/Section/Initialization" class="dashAnchor"></a>
<a href="#/Initialization">
<h3 class="section-name">Initialization</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:FC15PaperSwitchDemo14RAMPaperSwitchcFT4viewGSqCSo6UIView_5colorGSqCSo7UIColor__S0_"></a>
<a name="//apple_ref/swift/Method/init(view:color:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC15PaperSwitchDemo14RAMPaperSwitchcFT4viewGSqCSo6UIView_5colorGSqCSo7UIColor__S0_">init(view:color:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns an initialized switch object.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">required</span> <span class="nf">init</span><span class="p">(</span><span class="nv">view</span><span class="p">:</span> <span class="kt">UIView</span><span class="p">?,</span> <span class="nv">color</span><span class="p">:</span> <span class="kt">UIColor</span><span class="p">?)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>view</em>
</code>
</td>
<td>
<div>
<p>animatable view</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>color</em>
</code>
</td>
<td>
<div>
<p>The color which fill view.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>An initialized UISwitch object.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
+200
View File
@@ -0,0 +1,200 @@
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight {
/* Comment */
/* Error */
/* Keyword */
/* Operator */
/* Comment.Multiline */
/* Comment.Preproc */
/* Comment.Single */
/* Comment.Special */
/* Generic.Deleted */
/* Generic.Deleted.Specific */
/* Generic.Emph */
/* Generic.Error */
/* Generic.Heading */
/* Generic.Inserted */
/* Generic.Inserted.Specific */
/* Generic.Output */
/* Generic.Prompt */
/* Generic.Strong */
/* Generic.Subheading */
/* Generic.Traceback */
/* Keyword.Constant */
/* Keyword.Declaration */
/* Keyword.Pseudo */
/* Keyword.Reserved */
/* Keyword.Type */
/* Literal.Number */
/* Literal.String */
/* Name.Attribute */
/* Name.Builtin */
/* Name.Class */
/* Name.Constant */
/* Name.Entity */
/* Name.Exception */
/* Name.Function */
/* Name.Namespace */
/* Name.Tag */
/* Name.Variable */
/* Operator.Word */
/* Text.Whitespace */
/* Literal.Number.Float */
/* Literal.Number.Hex */
/* Literal.Number.Integer */
/* Literal.Number.Oct */
/* Literal.String.Backtick */
/* Literal.String.Char */
/* Literal.String.Doc */
/* Literal.String.Double */
/* Literal.String.Escape */
/* Literal.String.Heredoc */
/* Literal.String.Interpol */
/* Literal.String.Other */
/* Literal.String.Regex */
/* Literal.String.Single */
/* Literal.String.Symbol */
/* Name.Builtin.Pseudo */
/* Name.Variable.Class */
/* Name.Variable.Global */
/* Name.Variable.Instance */
/* Literal.Number.Integer.Long */ }
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }
+331
View File
@@ -0,0 +1,331 @@
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #f2f2f2;
font-family: Helvetica, freesans, Arial, sans-serif;
font-size: 14px;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 100;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
.section-name {
color: gray;
display: block;
font-family: Helvetica;
font-size: 22px;
font-weight: 100;
margin-bottom: 15px; }
pre, code {
font: 0.95em Menlo, monospace;
color: #777;
word-wrap: normal; }
p code, li code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px; }
a {
color: #0088cc;
text-decoration: none; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
.content-wrapper {
margin: 0 auto;
width: 980px; }
header {
font-size: 0.85em;
line-height: 26px;
background-color: #414141;
position: fixed;
width: 100%;
z-index: 1; }
header img {
padding-right: 6px;
vertical-align: -4px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs {
background-color: #f2f2f2;
height: 27px;
padding-top: 17px;
position: fixed;
width: 100%;
z-index: 1;
margin-top: 26px; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
.sidebar {
background-color: #f9f9f9;
border: 1px solid #e2e2e2;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
top: 70px;
bottom: 0;
width: 230px;
word-wrap: normal; }
.nav-groups {
list-style-type: none;
background: #fff;
padding-left: 0; }
.nav-group-name {
border-bottom: 1px solid #e2e2e2;
font-size: 1.1em;
font-weight: 100;
padding: 15px 0 15px 20px; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
margin-top: 5px; }
.nav-group-task {
font-size: 0.9em;
list-style-type: none; }
.nav-group-task a {
color: #888; }
.main-content {
background-color: #fff;
border: 1px solid #e2e2e2;
margin-left: 246px;
position: absolute;
overflow: hidden;
padding-bottom: 60px;
top: 70px;
width: 734px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.8em; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.section {
padding: 0 25px; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
margin: 0;
margin-left: 18px; }
.task-group-section {
padding-left: 6px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token {
padding-left: 3px;
margin-left: 15px;
font-size: 11.9px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
border-bottom: 1px solid #e2e2e2;
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
left: -25px;
padding: 0 25px;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
background: #f9f9f9;
border-bottom: 1px solid #e2e2e2;
left: -25px;
position: relative;
width: 100%;
padding-top: 10px;
padding-bottom: 5px; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 9px;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
position: absolute;
bottom: 10px;
margin-left: 25px; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
display: none; }
html.dash .main-content {
width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.jazzy.paperswitchdemo</string>
<key>CFBundleName</key>
<string>PaperSwitchDemo</string>
<key>DocSetPlatformFamily</key>
<string>jazzy</string>
<key>isDashDocset</key>
<true/>
<key>dashIndexFilePath</key>
<string>index.html</string>
<key>isJavaScriptEnabled</key>
<true/>
<key>DashDocSetFamily</key>
<string>dashtoc</string>
</dict>
</plist>
@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Classes Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">PaperSwitchDemo Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">PaperSwitchDemo Reference</a>
<img id="carat" src="img/carat.png" />
Classes Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/RAMPaperSwitch.html">RAMPaperSwitch</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Classes</h1>
<p>The following classes are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:C15PaperSwitchDemo14RAMPaperSwitch"></a>
<a name="//apple_ref/swift/Class/RAMPaperSwitch" class="dashAnchor"></a>
<a class="token" href="#/s:C15PaperSwitchDemo14RAMPaperSwitch">RAMPaperSwitch</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Swift subclass of the UISwitch which paints over the parent view with the onTintColor when the switch is turned on.</p>
<a href="Classes/RAMPaperSwitch.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">RAMPaperSwitch</span><span class="p">:</span> <span class="kt">UISwitch</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
@@ -0,0 +1,225 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>RAMPaperSwitch Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/RAMPaperSwitch" class="dashAnchor"></a>
<a title="RAMPaperSwitch Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">PaperSwitchDemo Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">PaperSwitchDemo Reference</a>
<img id="carat" src="../img/carat.png" />
RAMPaperSwitch Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/RAMPaperSwitch.html">RAMPaperSwitch</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>RAMPaperSwitch</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">RAMPaperSwitch</span><span class="p">:</span> <span class="kt">UISwitch</span></code></pre>
</div>
</div>
<p>Swift subclass of the UISwitch which paints over the parent view with the onTintColor when the switch is turned on.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vC15PaperSwitchDemo14RAMPaperSwitch8durationSd"></a>
<a name="//apple_ref/swift/Property/duration" class="dashAnchor"></a>
<a class="token" href="#/s:vC15PaperSwitchDemo14RAMPaperSwitch8durationSd">duration</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The total duration of the animations, measured in seconds. Default 0.35</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">@IBInspectable</span> <span class="kd">public</span> <span class="k">var</span> <span class="nv">duration</span><span class="p">:</span> <span class="kt">Double</span> <span class="o">=</span> <span class="mf">0.35</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vC15PaperSwitchDemo14RAMPaperSwitch24animationDidStartClosureFSbT_"></a>
<a name="//apple_ref/swift/Property/animationDidStartClosure" class="dashAnchor"></a>
<a class="token" href="#/s:vC15PaperSwitchDemo14RAMPaperSwitch24animationDidStartClosureFSbT_">animationDidStartClosure</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Closuer call when animation start</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">animationDidStartClosure</span> <span class="o">=</span> <span class="p">{(</span><span class="nv">onAnimation</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span> <span class="k">in</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vC15PaperSwitchDemo14RAMPaperSwitch23animationDidStopClosureFTSbSb_T_"></a>
<a name="//apple_ref/swift/Property/animationDidStopClosure" class="dashAnchor"></a>
<a class="token" href="#/s:vC15PaperSwitchDemo14RAMPaperSwitch23animationDidStopClosureFTSbSb_T_">animationDidStopClosure</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Closuer call when animation finish</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">animationDidStopClosure</span> <span class="o">=</span> <span class="p">{(</span><span class="nv">onAnimation</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">,</span> <span class="nv">finished</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span> <span class="k">in</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Initialization"></a>
<a name="//apple_ref/swift/Section/Initialization" class="dashAnchor"></a>
<a href="#/Initialization">
<h3 class="section-name">Initialization</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:FC15PaperSwitchDemo14RAMPaperSwitchcFT4viewGSqCSo6UIView_5colorGSqCSo7UIColor__S0_"></a>
<a name="//apple_ref/swift/Method/init(view:color:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC15PaperSwitchDemo14RAMPaperSwitchcFT4viewGSqCSo6UIView_5colorGSqCSo7UIColor__S0_">init(view:color:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns an initialized switch object.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">required</span> <span class="nf">init</span><span class="p">(</span><span class="nv">view</span><span class="p">:</span> <span class="kt">UIView</span><span class="p">?,</span> <span class="nv">color</span><span class="p">:</span> <span class="kt">UIColor</span><span class="p">?)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>view</em>
</code>
</td>
<td>
<div>
<p>animatable view</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>color</em>
</code>
</td>
<td>
<div>
<p>The color which fill view.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>An initialized UISwitch object.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
@@ -0,0 +1,200 @@
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight {
/* Comment */
/* Error */
/* Keyword */
/* Operator */
/* Comment.Multiline */
/* Comment.Preproc */
/* Comment.Single */
/* Comment.Special */
/* Generic.Deleted */
/* Generic.Deleted.Specific */
/* Generic.Emph */
/* Generic.Error */
/* Generic.Heading */
/* Generic.Inserted */
/* Generic.Inserted.Specific */
/* Generic.Output */
/* Generic.Prompt */
/* Generic.Strong */
/* Generic.Subheading */
/* Generic.Traceback */
/* Keyword.Constant */
/* Keyword.Declaration */
/* Keyword.Pseudo */
/* Keyword.Reserved */
/* Keyword.Type */
/* Literal.Number */
/* Literal.String */
/* Name.Attribute */
/* Name.Builtin */
/* Name.Class */
/* Name.Constant */
/* Name.Entity */
/* Name.Exception */
/* Name.Function */
/* Name.Namespace */
/* Name.Tag */
/* Name.Variable */
/* Operator.Word */
/* Text.Whitespace */
/* Literal.Number.Float */
/* Literal.Number.Hex */
/* Literal.Number.Integer */
/* Literal.Number.Oct */
/* Literal.String.Backtick */
/* Literal.String.Char */
/* Literal.String.Doc */
/* Literal.String.Double */
/* Literal.String.Escape */
/* Literal.String.Heredoc */
/* Literal.String.Interpol */
/* Literal.String.Other */
/* Literal.String.Regex */
/* Literal.String.Single */
/* Literal.String.Symbol */
/* Name.Builtin.Pseudo */
/* Name.Variable.Class */
/* Name.Variable.Global */
/* Name.Variable.Instance */
/* Literal.Number.Integer.Long */ }
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }
@@ -0,0 +1,331 @@
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #f2f2f2;
font-family: Helvetica, freesans, Arial, sans-serif;
font-size: 14px;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 100;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
.section-name {
color: gray;
display: block;
font-family: Helvetica;
font-size: 22px;
font-weight: 100;
margin-bottom: 15px; }
pre, code {
font: 0.95em Menlo, monospace;
color: #777;
word-wrap: normal; }
p code, li code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px; }
a {
color: #0088cc;
text-decoration: none; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
.content-wrapper {
margin: 0 auto;
width: 980px; }
header {
font-size: 0.85em;
line-height: 26px;
background-color: #414141;
position: fixed;
width: 100%;
z-index: 1; }
header img {
padding-right: 6px;
vertical-align: -4px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs {
background-color: #f2f2f2;
height: 27px;
padding-top: 17px;
position: fixed;
width: 100%;
z-index: 1;
margin-top: 26px; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
.sidebar {
background-color: #f9f9f9;
border: 1px solid #e2e2e2;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
top: 70px;
bottom: 0;
width: 230px;
word-wrap: normal; }
.nav-groups {
list-style-type: none;
background: #fff;
padding-left: 0; }
.nav-group-name {
border-bottom: 1px solid #e2e2e2;
font-size: 1.1em;
font-weight: 100;
padding: 15px 0 15px 20px; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
margin-top: 5px; }
.nav-group-task {
font-size: 0.9em;
list-style-type: none; }
.nav-group-task a {
color: #888; }
.main-content {
background-color: #fff;
border: 1px solid #e2e2e2;
margin-left: 246px;
position: absolute;
overflow: hidden;
padding-bottom: 60px;
top: 70px;
width: 734px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.8em; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.section {
padding: 0 25px; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
margin: 0;
margin-left: 18px; }
.task-group-section {
padding-left: 6px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token {
padding-left: 3px;
margin-left: 15px;
font-size: 11.9px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
border-bottom: 1px solid #e2e2e2;
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
left: -25px;
padding: 0 25px;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
background: #f9f9f9;
border-bottom: 1px solid #e2e2e2;
left: -25px;
position: relative;
width: 100%;
padding-top: 10px;
padding-bottom: 5px; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 9px;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
position: absolute;
bottom: 10px;
margin-left: 25px; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
display: none; }
html.dash .main-content {
width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }
Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PaperSwitchDemo Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="PaperSwitchDemo Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">PaperSwitchDemo Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">PaperSwitchDemo Reference</a>
<img id="carat" src="img/carat.png" />
PaperSwitchDemo Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/RAMPaperSwitch.html">RAMPaperSwitch</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<p><img src="https://raw.githubusercontent.com/Ramotion/paper-switch/master/header.png" alt="header"></p>
<a href='#rampaperswitch' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='rampaperswitch'>RAMPaperSwitch</h1>
<p><a href="https://cocoapods.org/pods/RAMPaperSwitch"><img src="https://img.shields.io/cocoapods/p/RAMPaperSwitch.svg" alt="CocoaPods"></a>
<a href="http://cocoapods.org/pods/RAMPaperSwitch"><img src="https://img.shields.io/cocoapods/v/RAMPaperSwitch.svg" alt="CocoaPods"></a>
<a href="https://cdn.rawgit.com/Ramotion/paper-switch/master/docs/index.html"><img src="https://img.shields.io/cocoapods/metrics/doc-percent/RAMPaperSwitch.svg" alt="CocoaPods"></a>
<a href="https://github.com/Ramotion/paper-switch"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible"></a>
<a href="http://twitter.com/Ramotion"><img src="https://img.shields.io/badge/Twitter-@Ramotion-blue.svg?style=flat" alt="Twitter"></a>
<a href="https://travis-ci.org/Ramotion/paper-switch"><img src="https://img.shields.io/travis/Ramotion/paper-switch.svg" alt="Travis"></a></p>
<p>Swift subclass of the UISwitch which paints over the parent view with the <code>onTintColor</code> when the switch is turned on. Implemented concept from <a href="https://dribbble.com/shots/1749645-Contact-Sync">this Dribbble</a> shot by <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">Ramotion</a>.</p>
<a href='#screenshot' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='screenshot'>Screenshot</h1>
<p><img src="https://raw.githubusercontent.com/Ramotion/paper-switch/master/screenshot.gif" alt="PaperSwitch"></p>
<p>The <a href="https://store.ramotion.com/product/iphone-6-plus-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">iPhone mockup</a> available <a href="https://store.ramotion.com/product/iphone-6-plus-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">here</a>.</p>
<a href='#requirements' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='requirements'>Requirements</h2>
<ul>
<li>iOS 8.0+</li>
<li>Xcode 6.1</li>
</ul>
<a href='#installation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='installation'>Installation</h1>
<p>Just add the <code>RAMPaperSwitch</code> folder to your project.</p>
<p>or use <a href="https://cocoapods.org">CocoaPods</a> with Podfile:
<code>ruby
pod &#39;RAMPaperSwitch&#39;
</code>
or <a href="https://github.com/Carthage/Carthage">Carthage</a> users can simply add to their <code>Cartfile</code>:
<code>
github &quot;Ramotion/paper-switch&quot;
</code></p>
<a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='usage'>Usage</h1>
<p>RAMPaperSwitch is a drop-in replacement of UISwitch. You just need to set the <code>onTintColor</code> property of the switch, and it will automatically <em>paint over</em> its superview with the selected color.
You have ability to set duration of animation instead of default value.</p>
<ol>
<li><p>Create a new UISwitch in your storyboard or nib.</p></li>
<li><p>Set the class of the UISwitch to RAMPaperSwitch in your Storyboard or nib.</p></li>
<li><p>Set <code>onTintColor</code> for the switch</p></li>
<li><p>Set <code>duration</code> property programmatically if You want to change animation duration.</p></li>
<li><p>Add animation for other views near the switch if need.</p></li>
</ol>
<a href='#animate_views' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='animate_views'>Animate views</h1>
<p>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&rsquo;s property <code>duration</code>. You can animate CoreAnimation properties like this:</p>
<pre class="highlight swift"><code><span class="k">self</span><span class="o">.</span><span class="n">paperSwitch</span><span class="o">.</span><span class="n">animationDidStartClosure</span> <span class="o">=</span> <span class="p">{(</span><span class="nv">onAnimation</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="k">in</span>
<span class="kt">UIView</span><span class="o">.</span><span class="nf">transitionWithView</span><span class="p">(</span><span class="k">self</span><span class="o">.</span><span class="n">label</span><span class="p">,</span> <span class="nv">duration</span><span class="p">:</span> <span class="k">self</span><span class="o">.</span><span class="n">paperSwitch</span><span class="o">.</span><span class="n">duration</span><span class="p">,</span> <span class="nv">options</span><span class="p">:</span> <span class="kt">UIViewAnimationOptions</span><span class="o">.</span><span class="kt">TransitionCrossDissolve</span><span class="p">,</span> <span class="nv">animations</span><span class="p">:</span> <span class="p">{</span>
<span class="k">self</span><span class="o">.</span><span class="n">label</span><span class="o">.</span><span class="n">textColor</span> <span class="o">=</span> <span class="n">onAnimation</span> <span class="p">?</span> <span class="kt">UIColor</span><span class="o">.</span><span class="nf">whiteColor</span><span class="p">()</span> <span class="p">:</span> <span class="kt">UIColor</span><span class="o">.</span><span class="nf">blueColor</span><span class="p">()</span>
<span class="p">},</span> <span class="nv">completion</span><span class="p">:</span><span class="kc">nil</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#about' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='about'>About</h2>
<p>The project maintained by <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">app development agency</a> <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">Ramotion Inc.</a>
See our other <a href="https://github.com/ramotion">open-source projects</a> or <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">hire</a> us to design, develop, and grow your product.</p>
<p><a href="https://twitter.com/intent/tweet?text=https://github.com/ramotion/paper-switch"><img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" alt="Twitter URL"></a>
<a href="https://twitter.com/ramotion"><img src="https://img.shields.io/twitter/follow/ramotion.svg?style=social" alt="Twitter Follow"></a></p>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
@@ -0,0 +1,40 @@
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
var tokenOffset = "15px";
var original = link.css('marginLeft') == tokenOffset;
link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
location.hash = href;
}
event.preventDefault();
});
File diff suppressed because one or more lines are too long
Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+116
View File
@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>PaperSwitchDemo Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="PaperSwitchDemo Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">PaperSwitchDemo Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">PaperSwitchDemo Reference</a>
<img id="carat" src="img/carat.png" />
PaperSwitchDemo Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/RAMPaperSwitch.html">RAMPaperSwitch</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<p><img src="https://raw.githubusercontent.com/Ramotion/paper-switch/master/header.png" alt="header"></p>
<a href='#rampaperswitch' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='rampaperswitch'>RAMPaperSwitch</h1>
<p><a href="https://cocoapods.org/pods/RAMPaperSwitch"><img src="https://img.shields.io/cocoapods/p/RAMPaperSwitch.svg" alt="CocoaPods"></a>
<a href="http://cocoapods.org/pods/RAMPaperSwitch"><img src="https://img.shields.io/cocoapods/v/RAMPaperSwitch.svg" alt="CocoaPods"></a>
<a href="https://cdn.rawgit.com/Ramotion/paper-switch/master/docs/index.html"><img src="https://img.shields.io/cocoapods/metrics/doc-percent/RAMPaperSwitch.svg" alt="CocoaPods"></a>
<a href="https://github.com/Ramotion/paper-switch"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible"></a>
<a href="http://twitter.com/Ramotion"><img src="https://img.shields.io/badge/Twitter-@Ramotion-blue.svg?style=flat" alt="Twitter"></a>
<a href="https://travis-ci.org/Ramotion/paper-switch"><img src="https://img.shields.io/travis/Ramotion/paper-switch.svg" alt="Travis"></a></p>
<p>Swift subclass of the UISwitch which paints over the parent view with the <code>onTintColor</code> when the switch is turned on. Implemented concept from <a href="https://dribbble.com/shots/1749645-Contact-Sync">this Dribbble</a> shot by <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">Ramotion</a>.</p>
<a href='#screenshot' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='screenshot'>Screenshot</h1>
<p><img src="https://raw.githubusercontent.com/Ramotion/paper-switch/master/screenshot.gif" alt="PaperSwitch"></p>
<p>The <a href="https://store.ramotion.com/product/iphone-6-plus-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">iPhone mockup</a> available <a href="https://store.ramotion.com/product/iphone-6-plus-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">here</a>.</p>
<a href='#requirements' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='requirements'>Requirements</h2>
<ul>
<li>iOS 8.0+</li>
<li>Xcode 6.1</li>
</ul>
<a href='#installation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='installation'>Installation</h1>
<p>Just add the <code>RAMPaperSwitch</code> folder to your project.</p>
<p>or use <a href="https://cocoapods.org">CocoaPods</a> with Podfile:
<code>ruby
pod &#39;RAMPaperSwitch&#39;
</code>
or <a href="https://github.com/Carthage/Carthage">Carthage</a> users can simply add to their <code>Cartfile</code>:
<code>
github &quot;Ramotion/paper-switch&quot;
</code></p>
<a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='usage'>Usage</h1>
<p>RAMPaperSwitch is a drop-in replacement of UISwitch. You just need to set the <code>onTintColor</code> property of the switch, and it will automatically <em>paint over</em> its superview with the selected color.
You have ability to set duration of animation instead of default value.</p>
<ol>
<li><p>Create a new UISwitch in your storyboard or nib.</p></li>
<li><p>Set the class of the UISwitch to RAMPaperSwitch in your Storyboard or nib.</p></li>
<li><p>Set <code>onTintColor</code> for the switch</p></li>
<li><p>Set <code>duration</code> property programmatically if You want to change animation duration.</p></li>
<li><p>Add animation for other views near the switch if need.</p></li>
</ol>
<a href='#animate_views' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='animate_views'>Animate views</h1>
<p>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&rsquo;s property <code>duration</code>. You can animate CoreAnimation properties like this:</p>
<pre class="highlight swift"><code><span class="k">self</span><span class="o">.</span><span class="n">paperSwitch</span><span class="o">.</span><span class="n">animationDidStartClosure</span> <span class="o">=</span> <span class="p">{(</span><span class="nv">onAnimation</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="k">in</span>
<span class="kt">UIView</span><span class="o">.</span><span class="nf">transitionWithView</span><span class="p">(</span><span class="k">self</span><span class="o">.</span><span class="n">label</span><span class="p">,</span> <span class="nv">duration</span><span class="p">:</span> <span class="k">self</span><span class="o">.</span><span class="n">paperSwitch</span><span class="o">.</span><span class="n">duration</span><span class="p">,</span> <span class="nv">options</span><span class="p">:</span> <span class="kt">UIViewAnimationOptions</span><span class="o">.</span><span class="kt">TransitionCrossDissolve</span><span class="p">,</span> <span class="nv">animations</span><span class="p">:</span> <span class="p">{</span>
<span class="k">self</span><span class="o">.</span><span class="n">label</span><span class="o">.</span><span class="n">textColor</span> <span class="o">=</span> <span class="n">onAnimation</span> <span class="p">?</span> <span class="kt">UIColor</span><span class="o">.</span><span class="nf">whiteColor</span><span class="p">()</span> <span class="p">:</span> <span class="kt">UIColor</span><span class="o">.</span><span class="nf">blueColor</span><span class="p">()</span>
<span class="p">},</span> <span class="nv">completion</span><span class="p">:</span><span class="kc">nil</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#about' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='about'>About</h2>
<p>The project maintained by <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">app development agency</a> <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">Ramotion Inc.</a>
See our other <a href="https://github.com/ramotion">open-source projects</a> or <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=paper-switch">hire</a> us to design, develop, and grow your product.</p>
<p><a href="https://twitter.com/intent/tweet?text=https://github.com/ramotion/paper-switch"><img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" alt="Twitter URL"></a>
<a href="https://twitter.com/ramotion"><img src="https://img.shields.io/twitter/follow/ramotion.svg?style=social" alt="Twitter Follow"></a></p>
</section>
</section>
<section id="footer">
<p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
+40
View File
@@ -0,0 +1,40 @@
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
var tokenOffset = "15px";
var original = link.css('marginLeft') == tokenOffset;
link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
location.hash = href;
}
event.preventDefault();
});
Vendored Executable
+4
View File
File diff suppressed because one or more lines are too long
View File
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB