19 Commits

Author SHA1 Message Date
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
10 changed files with 398 additions and 175 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
+170 -128
View File
@@ -22,137 +22,179 @@
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
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()
}
@IBInspectable 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)
}
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
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?
override public var on: Bool {
didSet(oldValue) {
oldState = on
}
}
// MARK: - Initialization
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 {
fatalError("set tint color")
}
if on == oldState {
return;
}
oldState = on
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.1'
s.summary = 'Swift subclass of the UISwitch which paints over the parent view'
s.homepage = 'https://github.com/Ramotion/paper-switch'
s.license = 'MIT'
+5 -7
View File
@@ -1,3 +1,4 @@
![header](./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)
@@ -5,7 +6,7 @@
[![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
@@ -26,7 +27,7 @@ Just add the `RAMPaperSwitch` folder to your project.
or use [CocoaPods](https://cocoapods.org) with Podfile:
``` ruby
pod 'RAMPaperSwitch', '~> 0.0.1'
pod 'RAMPaperSwitch', '~> 1.0.1'
```
@@ -57,11 +58,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)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB