Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ee6532f9d | |||
| 074e5746a6 | |||
| 96f767841b | |||
| b6482d0154 | |||
| 400db74caa | |||
| e5874511b8 | |||
| ec14608847 | |||
| 644d652ae7 | |||
| c6fd46ce2e | |||
| e1317b3203 | |||
| cac730d7df | |||
| afb8443639 | |||
| 772ead7101 | |||
| 39ed4afbe3 | |||
| 412de61727 | |||
| be0361f045 | |||
| 2cac5d0664 | |||
| dd0e87e3a1 | |||
| 4647af5d87 | |||
| 8ba2eb261e | |||
| 8c14dc8c10 | |||
| 762fde2a93 | |||
| 8de3e7832e | |||
| 2257016544 | |||
| d6166c1c4e | |||
| 388baf9a63 | |||
| d064819ec0 | |||
| db38ad1687 | |||
| 8440de329b | |||
| ac50a115ae | |||
| 40afc937cd | |||
| 1aaaa3769f | |||
| 791238e402 | |||
| ef52d5a09e |
+46
-5
@@ -1,6 +1,12 @@
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData/
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
@@ -9,18 +15,53 @@ build/
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
xcuserdata/
|
||||
|
||||
## Other
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.xccheckout
|
||||
*.xcscmblueprint
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
## Playgrounds
|
||||
timeline.xctimeline
|
||||
playground.xcworkspace
|
||||
|
||||
# Swift Package Manager
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
|
||||
# Packages/
|
||||
# Package.pins
|
||||
.build/
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
# Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://docs.fastlane.tools/best-practices/source-control/#source-control
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// swift-tools-version:5.1
|
||||
//
|
||||
// Package.swift
|
||||
//
|
||||
// Copyright (c) Ramotion (https://www.ramotion.com/)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import PackageDescription
|
||||
|
||||
|
||||
let package = Package(
|
||||
name: "PaperSwitch",
|
||||
platforms: [
|
||||
.iOS(.v9)
|
||||
],
|
||||
products: [
|
||||
.library(name: "PaperSwitch",
|
||||
targets: ["PaperSwitch"]),
|
||||
],
|
||||
targets: [
|
||||
.target(name: "PaperSwitch",
|
||||
path: "PaperSwitch")
|
||||
],
|
||||
swiftLanguageVersions: [.v5]
|
||||
)
|
||||
@@ -96,7 +96,7 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
|
||||
|
||||
showShapeIfNeed()
|
||||
|
||||
addTarget(self, action: #selector(RAMPaperSwitch.switchChanged), for: UIControlEvents.valueChanged)
|
||||
addTarget(self, action: #selector(RAMPaperSwitch.switchChanged), for: UIControl.Event.valueChanged)
|
||||
}
|
||||
|
||||
override open func layoutSubviews() {
|
||||
@@ -110,7 +110,7 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
|
||||
let additional = parentView == superview ? CGPoint.zero : (superview?.frame.origin ?? CGPoint.zero)
|
||||
|
||||
shape.frame = CGRect(x: center.x - radius + additional.x - 2, y: center.y - radius + additional.y, width: radius * 2, height: radius * 2)
|
||||
shape.anchorPoint = CGPoint(x: 0.5, y: 0.5);
|
||||
shape.anchorPoint = CGPoint(x: 0.5, y: 0.5)
|
||||
shape.path = UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: radius * 2, height: radius * 2)).cgPath
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
|
||||
super.setOn(on, animated: animated)
|
||||
|
||||
if changed {
|
||||
switchChangeWithAniation(animated)
|
||||
switchChangeWithAnimation(animated)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +130,8 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
|
||||
shape.transform = isOn ? CATransform3DMakeScale(1.0, 1.0, 1.0) : CATransform3DMakeScale(0.0001, 0.0001, 0.0001)
|
||||
}
|
||||
|
||||
internal func switchChanged() {
|
||||
switchChangeWithAniation(true)
|
||||
@objc internal func switchChanged() {
|
||||
switchChangeWithAnimation(true)
|
||||
}
|
||||
|
||||
// MARK: - Animations
|
||||
@@ -142,16 +142,16 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
|
||||
animation.fromValue = from
|
||||
animation.toValue = to
|
||||
animation.repeatCount = 1
|
||||
animation.timingFunction = CAMediaTimingFunction(name: timingFunction)
|
||||
animation.timingFunction = CAMediaTimingFunction(name: convertToCAMediaTimingFunctionName(timingFunction))
|
||||
animation.isRemovedOnCompletion = false
|
||||
animation.fillMode = kCAFillModeForwards
|
||||
animation.fillMode = CAMediaTimingFillMode.forwards
|
||||
animation.duration = duration
|
||||
animation.delegate = self
|
||||
|
||||
return animation
|
||||
}
|
||||
|
||||
fileprivate func switchChangeWithAniation(_ animation: Bool) {
|
||||
fileprivate func switchChangeWithAnimation(_ animation: Bool) {
|
||||
guard let onTintColor = self.onTintColor else {
|
||||
return
|
||||
}
|
||||
@@ -162,7 +162,7 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
|
||||
let scaleAnimation:CABasicAnimation = animateKeyPath(Constants.scale,
|
||||
fromValue: 0.01,
|
||||
toValue: 1.0,
|
||||
timing:kCAMediaTimingFunctionEaseIn);
|
||||
timing:convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn));
|
||||
if animation == false { scaleAnimation.duration = 0.0001 }
|
||||
|
||||
shape.add(scaleAnimation, forKey: Constants.up)
|
||||
@@ -170,7 +170,7 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
|
||||
let scaleAnimation:CABasicAnimation = animateKeyPath(Constants.scale,
|
||||
fromValue: 1.0,
|
||||
toValue: 0.01,
|
||||
timing:kCAMediaTimingFunctionEaseOut);
|
||||
timing:convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeOut));
|
||||
if animation == false { scaleAnimation.duration = 0.0001 }
|
||||
|
||||
shape.add(scaleAnimation, forKey: Constants.down)
|
||||
@@ -191,3 +191,13 @@ open class RAMPaperSwitch: UISwitch, CAAnimationDelegate {
|
||||
animationDidStopClosure(isOn, flag)
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function inserted by Swift 4.2 migrator.
|
||||
fileprivate func convertToCAMediaTimingFunctionName(_ input: String) -> CAMediaTimingFunctionName {
|
||||
return CAMediaTimingFunctionName(rawValue: input)
|
||||
}
|
||||
|
||||
// Helper function inserted by Swift 4.2 migrator.
|
||||
fileprivate func convertFromCAMediaTimingFunctionName(_ input: CAMediaTimingFunctionName) -> String {
|
||||
return input.rawValue
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -260,29 +260,29 @@
|
||||
attributes = {
|
||||
LastSwiftMigration = 0700;
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0800;
|
||||
LastUpgradeCheck = 1020;
|
||||
ORGANIZATIONNAME = Ramotion;
|
||||
TargetAttributes = {
|
||||
84BE57D11CFF03ED0073C92B = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
DevelopmentTeam = 34MUF9YXTA;
|
||||
LastSwiftMigration = 0800;
|
||||
LastSwiftMigration = 1020;
|
||||
};
|
||||
9C6889F91A274993008BFF1E = {
|
||||
CreatedOnToolsVersion = 6.1;
|
||||
LastSwiftMigration = 0800;
|
||||
LastSwiftMigration = 1020;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
9C688A0E1A274993008BFF1E = {
|
||||
CreatedOnToolsVersion = 6.1;
|
||||
LastSwiftMigration = 0800;
|
||||
LastSwiftMigration = 1020;
|
||||
TestTargetID = 9C6889F91A274993008BFF1E;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 9C6889F51A274993008BFF1E /* Build configuration list for PBXProject "PaperSwitchDemo" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
@@ -374,7 +374,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEFINES_MODULE = YES;
|
||||
@@ -390,7 +390,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.PaperSwitch;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
@@ -416,7 +416,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.PaperSwitch;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
@@ -430,14 +430,22 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -465,7 +473,7 @@
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -478,14 +486,22 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -505,7 +521,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
@@ -522,7 +538,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -537,7 +553,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -557,7 +573,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PaperSwitchDemo.app/PaperSwitchDemo";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -574,7 +590,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PaperSwitchDemo.app/PaperSwitchDemo";
|
||||
};
|
||||
name = Release;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,13 +57,13 @@ class ViewController: UIViewController {
|
||||
}
|
||||
|
||||
fileprivate func animateLabel(_ label: UILabel, onAnimation: Bool, duration: TimeInterval) {
|
||||
UIView.transition(with: label, duration: duration, options: UIViewAnimationOptions.transitionCrossDissolve, animations: {
|
||||
UIView.transition(with: label, duration: duration, options: UIView.AnimationOptions.transitionCrossDissolve, animations: {
|
||||
label.textColor = onAnimation ? UIColor.white : UIColor(red: 31/255.0, green: 183/255.0, blue: 252/255.0, alpha: 1)
|
||||
}, completion:nil)
|
||||
}
|
||||
|
||||
fileprivate func animateImageView(_ imageView: UIImageView, onAnimation: Bool, duration: TimeInterval) {
|
||||
UIView.transition(with: imageView, duration: duration, options: UIViewAnimationOptions.transitionCrossDissolve, animations: {
|
||||
UIView.transition(with: imageView, duration: duration, options: UIView.AnimationOptions.transitionCrossDissolve, animations: {
|
||||
imageView.image = UIImage(named: onAnimation ? "img_phone_on" : "img_phone_off")
|
||||
}, completion:nil)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'RAMPaperSwitch'
|
||||
s.version = '2.0.3'
|
||||
s.version = '3.1.0'
|
||||
s.summary = 'Swift subclass of the UISwitch which paints over the parent view'
|
||||
s.homepage = 'https://github.com/Ramotion/paper-switch'
|
||||
s.license = 'MIT'
|
||||
|
||||
@@ -1,35 +1,47 @@
|
||||
[](https://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch-logo)
|
||||
#RAMPaperSwitch
|
||||
<a href="https://www.ramotion.com/agency/app-development/?utm_source=gthb&utm_medium=repo&utm_campaign=folding-cell"><img src="https://github.com/Ramotion/folding-cell/blob/master/header.png"></a>
|
||||
|
||||
<a href="https://github.com/Ramotion/folding-cell">
|
||||
<img align="left" src="https://github.com/Ramotion/paper-switch/blob/master/paper-switch.gif" width="480" height="360" /></a>
|
||||
|
||||
<p><h1 align="left">PAPER SWITCH</h1></p>
|
||||
|
||||
<h4>A Swift material design UI module which paints over the parent view when the switch is on.</h4>
|
||||
|
||||
|
||||
___
|
||||
|
||||
|
||||
|
||||
<p><h6>We specialize in the designing and coding of custom UI for Mobile Apps and Websites.</h6>
|
||||
<a href="https://www.ramotion.com/agency/app-development/?utm_source=gthb&utm_medium=repo&utm_campaign=paper-switch">
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
|
||||
</p>
|
||||
<p><h6>Stay tuned for the latest updates:</h6>
|
||||
<a href="https://goo.gl/rPFpid" >
|
||||
<img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a></p>
|
||||
|
||||
</br>
|
||||
|
||||
[](https://cocoapods.org/pods/RAMPaperSwitch)
|
||||
[](http://cocoapods.org/pods/RAMPaperSwitch)
|
||||
[](https://cdn.rawgit.com/Ramotion/paper-switch/master/docs/index.html)
|
||||
[](https://github.com/Ramotion/paper-switch)
|
||||
[](http://twitter.com/Ramotion)
|
||||
[](https://travis-ci.org/Ramotion/paper-switch)
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
## About
|
||||
This project is maintained by Ramotion, Inc.<br>
|
||||
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.<br><br>**Looking for developers for your project?** [[▶︎CONTACT OUR TEAM◀︎](http://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=paper-switch-contact-us/#Get_in_Touch)]
|
||||
|
||||
#Screenshot
|
||||
[](https://dribbble.com/shots/1749645-Contact-Sync)
|
||||
|
||||
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).
|
||||
|
||||
[](https://paypal.me/Ramotion)
|
||||
|
||||
## Requirements
|
||||
|
||||
- iOS 8.0+
|
||||
- Xcode 6.1
|
||||
- Xcode 9.0+
|
||||
|
||||
#Installation
|
||||
# Installation
|
||||
|
||||
Just add the `RAMPaperSwitch` folder to your project.
|
||||
|
||||
or use [CocoaPods](https://cocoapods.org) with Podfile:
|
||||
``` ruby
|
||||
pod 'RAMPaperSwitch', '~> 2.0.3'
|
||||
pod 'RAMPaperSwitch'
|
||||
```
|
||||
or [Carthage](https://github.com/Carthage/Carthage) users can simply add to their `Cartfile`:
|
||||
```
|
||||
@@ -37,7 +49,7 @@ github "Ramotion/paper-switch"
|
||||
```
|
||||
|
||||
|
||||
#Usage
|
||||
# Usage
|
||||
RAMPaperSwitch is a drop-in replacement of UISwitch. You just need to set the `onTintColor` property of the switch, and it will automatically _paint over_ its superview with the selected color.
|
||||
You have ability to set duration of animation instead of default value.
|
||||
|
||||
@@ -52,7 +64,7 @@ You have ability to set duration of animation instead of default value.
|
||||
5. Add animation for other views near the switch if need.
|
||||
|
||||
|
||||
#Animate views
|
||||
# Animate views
|
||||
You can animate other views near the switch. For example, you can change color to views or labels that are inside the same superview. Duration of animation can be gotten from the RAMPaperSwitch's property `duration`. You can animate CoreAnimation properties like this:
|
||||
|
||||
``` swift
|
||||
@@ -63,7 +75,24 @@ self.paperSwitch.animationDidStartClosure = {(onAnimation: Bool) in
|
||||
}
|
||||
```
|
||||
|
||||
## Folow Us
|
||||
<br>
|
||||
|
||||
[](https://twitter.com/intent/tweet?text=https://github.com/ramotion/paper-switch)
|
||||
[](https://twitter.com/ramotion)
|
||||
## 📄 License
|
||||
|
||||
Paper Switch is released under the MIT license.
|
||||
See [LICENSE](./LICENSE) for details.
|
||||
|
||||
This library is a part of a <a href="https://github.com/Ramotion/swift-ui-animation-components-and-libraries"><b>selection of our best UI open-source projects.</b></a>
|
||||
|
||||
If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com
|
||||
|
||||
## 📱 Get the Showroom App for iOS to give it a try
|
||||
Try this UI component and more like this in our iOS app. Contact us if interested.
|
||||
|
||||
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=folding-cell&mt=8" >
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png" width="117" height="34"></a>
|
||||
|
||||
<a href="https://www.ramotion.com/agency/app-development/?utm_source=gthb&utm_medium=repo&utm_campaign=folding-cell">
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 MiB |
Reference in New Issue
Block a user