Commit 3898ce7f by Daniel Dahan

Merge branch 'storyboard-examples' into development

parents 163c8863 54b91588
...@@ -65,12 +65,12 @@ class ViewController: UIViewController { ...@@ -65,12 +65,12 @@ class ViewController: UIViewController {
private func prepareFavoriteButton() { private func prepareFavoriteButton() {
favoriteButton = IconButton(image: Icon.favorite, tintColor: Color.white) favoriteButton = IconButton(image: Icon.favorite, tintColor: Color.white)
favoriteButton.pulse.color = Color.white favoriteButton.pulseColor = Color.white
} }
private func prepareShareButton() { private func prepareShareButton() {
shareButton = IconButton(image: Icon.cm.share, tintColor: Color.white) shareButton = IconButton(image: Icon.cm.share, tintColor: Color.white)
shareButton.pulse.color = Color.white shareButton.pulseColor = Color.white
} }
private func prepareTitleLabel() { private func prepareTitleLabel() {
......
...@@ -77,7 +77,7 @@ class ViewController: UIViewController { ...@@ -77,7 +77,7 @@ class ViewController: UIViewController {
private func prepareRaisedButton() { private func prepareRaisedButton() {
let button = RaisedButton(title: "Raised Button", titleColor: Color.white) let button = RaisedButton(title: "Raised Button", titleColor: Color.white)
button.pulse.color = Color.white button.pulseColor = Color.white
button.backgroundColor = Color.blue.base button.backgroundColor = Color.blue.base
view.layout(button) view.layout(button)
......
...@@ -77,7 +77,7 @@ class RootViewController: UIViewController { ...@@ -77,7 +77,7 @@ class RootViewController: UIViewController {
private func prepareNextButton() { private func prepareNextButton() {
nextButton = FlatButton() nextButton = FlatButton()
nextButton.pulse.animation = .none nextButton.pulseAnimation = .none
nextButton.addTarget(self, action: #selector(handleNextButton), for: .touchUpInside) nextButton.addTarget(self, action: #selector(handleNextButton), for: .touchUpInside)
view.layout(nextButton).edges() view.layout(nextButton).edges()
} }
......
...@@ -51,7 +51,7 @@ class RootViewController: UIViewController { ...@@ -51,7 +51,7 @@ class RootViewController: UIViewController {
private func prepareUndoButton() { private func prepareUndoButton() {
undoButton = FlatButton(title: "Undo", titleColor: Color.yellow.base) undoButton = FlatButton(title: "Undo", titleColor: Color.yellow.base)
undoButton.pulse.animation = .backing undoButton.pulseAnimation = .backing
undoButton.titleLabel?.font = RobotoFont.regular(with: 14) undoButton.titleLabel?.font = RobotoFont.regular(with: 14)
} }
......
...@@ -48,15 +48,15 @@ class ViewController: UIViewController { ...@@ -48,15 +48,15 @@ class ViewController: UIViewController {
private func prepareButtons() { private func prepareButtons() {
let btn1 = FlatButton(title: "Library", titleColor: Color.blueGrey.base) let btn1 = FlatButton(title: "Library", titleColor: Color.blueGrey.base)
btn1.pulse.animation = .none btn1.pulseAnimation = .none
buttons.append(btn1) buttons.append(btn1)
let btn2 = FlatButton(title: "Photo", titleColor: Color.blueGrey.base) let btn2 = FlatButton(title: "Photo", titleColor: Color.blueGrey.base)
btn2.pulse.animation = .none btn2.pulseAnimation = .none
buttons.append(btn2) buttons.append(btn2)
let btn3 = FlatButton(title: "Video", titleColor: Color.blueGrey.base) let btn3 = FlatButton(title: "Video", titleColor: Color.blueGrey.base)
btn3.pulse.animation = .none btn3.pulseAnimation = .none
buttons.append(btn3) buttons.append(btn3)
} }
......
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
9A05728E1D99E64100341332 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A05728D1D99E64100341332 /* AppDelegate.swift */; };
9A0572901D99E64100341332 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A05728F1D99E64100341332 /* ViewController.swift */; };
9A0572931D99E64100341332 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A0572911D99E64100341332 /* Main.storyboard */; };
9A0572951D99E64100341332 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9A0572941D99E64100341332 /* Assets.xcassets */; };
9A0572981D99E64100341332 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A0572961D99E64100341332 /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9690B4151D99FF2700E7F42A /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
9A05728A1D99E64100341332 /* Button.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Button.app; sourceTree = BUILT_PRODUCTS_DIR; };
9A05728D1D99E64100341332 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9A05728F1D99E64100341332 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
9A0572921D99E64100341332 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
9A0572941D99E64100341332 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
9A0572971D99E64100341332 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
9A0572991D99E64100341332 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
9A0572871D99E64100341332 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9A0572811D99E64100341332 = {
isa = PBXGroup;
children = (
9A05728C1D99E64100341332 /* Button */,
9A05728B1D99E64100341332 /* Products */,
);
sourceTree = "<group>";
};
9A05728B1D99E64100341332 /* Products */ = {
isa = PBXGroup;
children = (
9A05728A1D99E64100341332 /* Button.app */,
);
name = Products;
sourceTree = "<group>";
};
9A05728C1D99E64100341332 /* Button */ = {
isa = PBXGroup;
children = (
9A05728D1D99E64100341332 /* AppDelegate.swift */,
9A05728F1D99E64100341332 /* ViewController.swift */,
9A0572911D99E64100341332 /* Main.storyboard */,
9A0572941D99E64100341332 /* Assets.xcassets */,
9A0572961D99E64100341332 /* LaunchScreen.storyboard */,
9A0572991D99E64100341332 /* Info.plist */,
);
path = Button;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
9A0572891D99E64100341332 /* Button */ = {
isa = PBXNativeTarget;
buildConfigurationList = 9A05729C1D99E64100341332 /* Build configuration list for PBXNativeTarget "Button" */;
buildPhases = (
9A0572861D99E64100341332 /* Sources */,
9A0572871D99E64100341332 /* Frameworks */,
9A0572881D99E64100341332 /* Resources */,
9690B4151D99FF2700E7F42A /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = Button;
productName = Button;
productReference = 9A05728A1D99E64100341332 /* Button.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
9A0572821D99E64100341332 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = CosmicMind;
TargetAttributes = {
9A0572891D99E64100341332 = {
CreatedOnToolsVersion = 8.0;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 9A0572851D99E64100341332 /* Build configuration list for PBXProject "Button" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 9A0572811D99E64100341332;
productRefGroup = 9A05728B1D99E64100341332 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
9A0572891D99E64100341332 /* Button */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
9A0572881D99E64100341332 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9A0572981D99E64100341332 /* LaunchScreen.storyboard in Resources */,
9A0572951D99E64100341332 /* Assets.xcassets in Resources */,
9A0572931D99E64100341332 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
9A0572861D99E64100341332 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9A0572901D99E64100341332 /* ViewController.swift in Sources */,
9A05728E1D99E64100341332 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
9A0572911D99E64100341332 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
9A0572921D99E64100341332 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
9A0572961D99E64100341332 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
9A0572971D99E64100341332 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
9A05729A1D99E64100341332 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
9A05729B1D99E64100341332 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
9A05729D1D99E64100341332 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Button/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Button;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
9A05729E1D99E64100341332 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Button/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Button;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
9A0572851D99E64100341332 /* Build configuration list for PBXProject "Button" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9A05729A1D99E64100341332 /* Debug */,
9A05729B1D99E64100341332 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
9A05729C1D99E64100341332 /* Build configuration list for PBXNativeTarget "Button" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9A05729D1D99E64100341332 /* Debug */,
9A05729E1D99E64100341332 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 9A0572821D99E64100341332 /* Project object */;
}
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Button.xcodeproj">
</FileRef>
</Workspace>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Button" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="HIy-Yt-SER" customClass="FlatButton" customModule="Material">
<frame key="frameInset" minX="50.00%" minY="149" width="153" height="49"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Flat Button"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="title" value="Flat Button"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="xu1-qa-63H" customClass="RaisedButton" customModule="Material">
<frame key="frameInset" minX="49.75%" minY="227" width="174" height="49"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.0" green="0.50196081400000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<state key="normal" title="Raised Button"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="3"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
<color key="value" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="size" keyPath="shadowOffset">
<size key="value" width="1" height="1"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="backgroundColor">
<color key="value" red="0.0" green="0.50196081400000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="string" keyPath="title" value="Raised Button"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="IqT-sg-mjt" customClass="FabButton" customModule="Material">
<frame key="frameInset" minX="49.84%" minY="312" width="60" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="0.93803510270000001" colorSpace="calibratedRGB"/>
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<state key="normal" image="cm_pen_white"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="image" keyPath="image" value="cm_pen_white"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="Aqc-uz-GVW" customClass="IconButton" customModule="Material">
<frame key="frameInset" minX="164" minY="398" height="40" maxX="171"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<state key="normal" image="cm_search_white"/>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<connections>
<outlet property="fabButton" destination="IqT-sg-mjt" id="DvE-hp-bo2"/>
<outlet property="iconButton" destination="Aqc-uz-GVW" id="Ba4-If-S9Z"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-377.5" y="-13.5"/>
</scene>
</scenes>
<resources>
<image name="cm_pen_white" width="24" height="24"/>
<image name="cm_search_white" width="24" height="24"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4_7.fullscreen"/>
</simulatedMetricsContainer>
</document>
<?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>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class ViewController: UIViewController {
@IBOutlet weak var fabButton: FabButton!
@IBOutlet weak var iconButton: IconButton!
override func viewDidLoad() {
super.viewDidLoad()
prepareFabButton()
prepareIconButton()
}
func prepareFabButton() {
fabButton.image = Icon.cm.add
fabButton.pulseColor = Color.white
}
func prepareIconButton() {
iconButton.image = Icon.search
iconButton.pulseColor = Color.blue.base
}
}
...@@ -74,5 +74,12 @@ ...@@ -74,5 +74,12 @@
location = "group:Examples/Programmatic/View/View.xcodeproj"> location = "group:Examples/Programmatic/View/View.xcodeproj">
</FileRef> </FileRef>
</Group> </Group>
<Group
location = "container:"
name = "Storyboards">
<FileRef
location = "group:Examples/Storyboards/Button/Button.xcodeproj">
</FileRef>
</Group>
</Group> </Group>
</Workspace> </Workspace>
...@@ -102,7 +102,39 @@ open class Bar: View { ...@@ -102,7 +102,39 @@ open class Bar: View {
} }
/// Divider layer. /// Divider layer.
open internal(set) var divider: Divider! internal lazy var divider: Divider = Divider(view: self)
/// Divider color.
@IBInspectable
open var dividerColor: UIColor? {
get {
return divider.color
}
set(value) {
divider.color = value
}
}
/// Divider animation.
open var dividerAlignment: DividerAlignment {
get {
return divider.alignment
}
set(value) {
divider.alignment = value
}
}
/// Divider height.
@IBInspectable
open var dividerHeight: CGFloat {
get {
return divider.height
}
set(value) {
divider.height = value
}
}
/// ContentView that holds the any desired subviews. /// ContentView that holds the any desired subviews.
open private(set) lazy var contentView = View() open private(set) lazy var contentView = View()
...@@ -233,16 +265,10 @@ open class Bar: View { ...@@ -233,16 +265,10 @@ open class Bar: View {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
prepareContentView() prepareContentView()
prepareDivider()
} }
/// Prepares the contentView. /// Prepares the contentView.
private func prepareContentView() { private func prepareContentView() {
contentView.backgroundColor = nil contentView.backgroundColor = nil
} }
/// Prepares the divider.
private func prepareDivider() {
divider = Divider(view: self)
}
} }
...@@ -123,7 +123,7 @@ open class BottomTabBar: UITabBar { ...@@ -123,7 +123,7 @@ open class BottomTabBar: UITabBar {
*/ */
public func prepare() { public func prepare() {
depthPreset = .depth1 depthPreset = .depth1
divider.alignment = .top dividerAlignment = .top
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
backgroundColor = Color.white backgroundColor = Color.white
let image = UIImage.imageWithColor(color: Color.clear, size: CGSize(width: 1, height: 1)) let image = UIImage.imageWithColor(color: Color.clear, size: CGSize(width: 1, height: 1))
...@@ -137,7 +137,7 @@ private var TabBarKey: UInt8 = 0 ...@@ -137,7 +137,7 @@ private var TabBarKey: UInt8 = 0
extension UITabBar { extension UITabBar {
/// TabBarItem reference. /// TabBarItem reference.
public internal(set) var divider: Divider! { internal private(set) var divider: Divider! {
get { get {
return AssociatedObject(base: self, key: &TabBarKey) { return AssociatedObject(base: self, key: &TabBarKey) {
return Divider(view: self) return Divider(view: self)
...@@ -147,5 +147,37 @@ extension UITabBar { ...@@ -147,5 +147,37 @@ extension UITabBar {
AssociateObject(base: self, key: &TabBarKey, value: value) AssociateObject(base: self, key: &TabBarKey, value: value)
} }
} }
/// Divider color.
@IBInspectable
open var dividerColor: UIColor? {
get {
return divider.color
}
set(value) {
divider.color = value
}
}
/// Divider animation.
open var dividerAlignment: DividerAlignment {
get {
return divider.alignment
}
set(value) {
divider.alignment = value
}
}
/// Divider height.
@IBInspectable
open var dividerHeight: CGFloat {
get {
return divider.height
}
set(value) {
divider.height = value
}
}
} }
...@@ -41,9 +41,40 @@ open class Button: UIButton { ...@@ -41,9 +41,40 @@ open class Button: UIButton {
open private(set) lazy var visualLayer = CAShapeLayer() open private(set) lazy var visualLayer = CAShapeLayer()
/// A Pulse reference. /// A Pulse reference.
@IBInspectable internal private(set) lazy var pulse: Pulse = Pulse()
open internal(set) lazy var pulse: Pulse = Pulse()
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
get {
return pulse.animation
}
set(value) {
pulse.animation = value
}
}
/// PulseAnimation color.
@IBInspectable
open var pulseColor: UIColor {
get {
return pulse.color
}
set(value) {
pulse.color = value
}
}
/// Pulse opacity.
@IBInspectable
open var pulseOpacity: CGFloat {
get {
return pulse.opacity
}
set(value) {
pulse.opacity = value
}
}
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
......
...@@ -180,7 +180,7 @@ open class Card: PulseView { ...@@ -180,7 +180,7 @@ open class Card: PulseView {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
depthPreset = .depth1 depthPreset = .depth1
pulse.animation = .none pulseAnimation = .none
} }
/** /**
......
...@@ -41,8 +41,39 @@ open class CollectionReusableView: UICollectionReusableView { ...@@ -41,8 +41,39 @@ open class CollectionReusableView: UICollectionReusableView {
open private(set) lazy var visualLayer = CAShapeLayer() open private(set) lazy var visualLayer = CAShapeLayer()
/// A Pulse reference. /// A Pulse reference.
internal private(set) lazy var pulse: Pulse = Pulse()
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
get {
return pulse.animation
}
set(value) {
pulse.animation = value
}
}
/// PulseAnimation color.
@IBInspectable @IBInspectable
open internal(set) lazy var pulse: Pulse = Pulse() open var pulseColor: UIColor {
get {
return pulse.color
}
set(value) {
pulse.color = value
}
}
/// Pulse opacity.
@IBInspectable
open var pulseOpacity: CGFloat {
get {
return pulse.opacity
}
set(value) {
pulse.opacity = value
}
}
/** /**
A property that manages an image for the visualLayer's contents A property that manages an image for the visualLayer's contents
......
...@@ -32,8 +32,40 @@ import UIKit ...@@ -32,8 +32,40 @@ import UIKit
@objc(CollectionViewCell) @objc(CollectionViewCell)
open class CollectionViewCell: UICollectionViewCell { open class CollectionViewCell: UICollectionViewCell {
/// A reference to the divider. /// Divider layer.
open internal(set) var divider: Divider! internal private(set) lazy var divider: Divider = Divider(view: self)
/// Divider color.
@IBInspectable
open var dividerColor: UIColor? {
get {
return divider.color
}
set(value) {
divider.color = value
}
}
/// Divider animation.
open var dividerAlignment: DividerAlignment {
get {
return divider.alignment
}
set(value) {
divider.alignment = value
}
}
/// Divider height.
@IBInspectable
open var dividerHeight: CGFloat {
get {
return divider.height
}
set(value) {
divider.height = value
}
}
/** /**
A CAShapeLayer used to manage elements that would be affected by A CAShapeLayer used to manage elements that would be affected by
...@@ -44,8 +76,39 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -44,8 +76,39 @@ open class CollectionViewCell: UICollectionViewCell {
open private(set) lazy var visualLayer = CAShapeLayer() open private(set) lazy var visualLayer = CAShapeLayer()
/// A Pulse reference. /// A Pulse reference.
internal private(set) lazy var pulse: Pulse = Pulse()
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
get {
return pulse.animation
}
set(value) {
pulse.animation = value
}
}
/// PulseAnimation color.
@IBInspectable
open var pulseColor: UIColor {
get {
return pulse.color
}
set(value) {
pulse.color = value
}
}
/// Pulse opacity.
@IBInspectable @IBInspectable
open internal(set) lazy var pulse: Pulse = Pulse() open var pulseOpacity: CGFloat {
get {
return pulse.opacity
}
set(value) {
pulse.opacity = value
}
}
/** /**
A property that manages an image for the visualLayer's contents A property that manages an image for the visualLayer's contents
...@@ -268,7 +331,6 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -268,7 +331,6 @@ open class CollectionViewCell: UICollectionViewCell {
open func prepare() { open func prepare() {
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
prepareVisualLayer() prepareVisualLayer()
prepareDivider()
} }
/// Prepares the visualLayer property. /// Prepares the visualLayer property.
...@@ -283,9 +345,4 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -283,9 +345,4 @@ open class CollectionViewCell: UICollectionViewCell {
visualLayer.frame = bounds visualLayer.frame = bounds
visualLayer.cornerRadius = cornerRadius visualLayer.cornerRadius = cornerRadius
} }
/// Prepares the divider.
private func prepareDivider() {
divider = Divider(view: self)
}
} }
...@@ -42,8 +42,8 @@ open class FabButton: Button { ...@@ -42,8 +42,8 @@ open class FabButton: Button {
super.prepare() super.prepare()
depthPreset = .depth1 depthPreset = .depth1
shapePreset = .circle shapePreset = .circle
pulse.animation = .centerWithBacking pulseAnimation = .centerWithBacking
pulse.color = Color.white pulseColor = Color.white
tintColor = Color.white tintColor = Color.white
backgroundColor = Color.red.base backgroundColor = Color.red.base
} }
......
...@@ -40,6 +40,6 @@ open class IconButton: Button { ...@@ -40,6 +40,6 @@ open class IconButton: Button {
*/ */
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
pulse.animation = .center pulseAnimation = .center
} }
} }
...@@ -39,8 +39,40 @@ public enum NavigationBarStyle: Int { ...@@ -39,8 +39,40 @@ public enum NavigationBarStyle: Int {
} }
open class NavigationBar: UINavigationBar { open class NavigationBar: UINavigationBar {
/// A reference to the divider. /// Divider layer.
open internal(set) var divider: Divider! internal private(set) lazy var divider: Divider = Divider(view: self)
/// Divider color.
@IBInspectable
open var dividerColor: UIColor? {
get {
return divider.color
}
set(value) {
divider.color = value
}
}
/// Divider animation.
open var dividerAlignment: DividerAlignment {
get {
return divider.alignment
}
set(value) {
divider.alignment = value
}
}
/// Divider height.
@IBInspectable
open var dividerHeight: CGFloat {
get {
return divider.height
}
set(value) {
divider.height = value
}
}
open override var intrinsicContentSize: CGSize { open override var intrinsicContentSize: CGSize {
switch navigationBarStyle { switch navigationBarStyle {
...@@ -174,9 +206,7 @@ open class NavigationBar: UINavigationBar { ...@@ -174,9 +206,7 @@ open class NavigationBar: UINavigationBar {
layoutNavigationItem(item: v) layoutNavigationItem(item: v)
} }
if let v = divider { divider.reload()
v.reload()
}
} }
open override func pushItem(_ item: UINavigationItem, animated: Bool) { open override func pushItem(_ item: UINavigationItem, animated: Bool) {
...@@ -305,7 +335,6 @@ open class NavigationBar: UINavigationBar { ...@@ -305,7 +335,6 @@ open class NavigationBar: UINavigationBar {
shadowImage = image shadowImage = image
setBackgroundImage(image, for: .default) setBackgroundImage(image, for: .default)
backgroundColor = Color.white backgroundColor = Color.white
prepareDivider()
} }
/** /**
...@@ -327,9 +356,4 @@ open class NavigationBar: UINavigationBar { ...@@ -327,9 +356,4 @@ open class NavigationBar: UINavigationBar {
} }
item.titleView = UIView(frame: .zero) item.titleView = UIView(frame: .zero)
} }
/// Prepares the divider.
private func prepareDivider() {
divider = Divider(view: self)
}
} }
...@@ -36,7 +36,7 @@ private var PageTabBarItemKey: UInt8 = 0 ...@@ -36,7 +36,7 @@ private var PageTabBarItemKey: UInt8 = 0
open class PageTabBarItem: FlatButton { open class PageTabBarItem: FlatButton {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
pulse.animation = .none pulseAnimation = .none
} }
} }
......
...@@ -30,18 +30,16 @@ ...@@ -30,18 +30,16 @@
import UIKit import UIKit
open class Pulse { internal struct Pulse {
/// An Array of layers. /// An Array of layers.
internal lazy var layers = [CAShapeLayer]() internal lazy var layers = [CAShapeLayer]()
/// A UIColor. /// A UIColor.
@IBInspectable internal var color = Color.grey.base
open var color = Color.grey.base
/// A reference to the PulseAnimation. /// A reference to the PulseAnimation.
open var animation = PulseAnimation.pointWithBacking internal var animation = PulseAnimation.pointWithBacking
/// The opcaity value for the pulse animation. /// The opcaity value for the pulse animation.
@IBInspectable internal var opacity: CGFloat = 0.18
open var opacity: CGFloat = 0.18
} }
...@@ -31,9 +31,40 @@ ...@@ -31,9 +31,40 @@
import UIKit import UIKit
open class PulseView: View { open class PulseView: View {
/// A Pulse reference. /// A Pulse reference.
@IBInspectable internal private(set) lazy var pulse: Pulse = Pulse()
open internal(set) lazy var pulse: Pulse = Pulse()
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
get {
return pulse.animation
}
set(value) {
pulse.animation = value
}
}
/// PulseAnimation color.
@IBInspectable
open var pulseColor: UIColor {
get {
return pulse.color
}
set(value) {
pulse.color = value
}
}
/// Pulse opacity.
@IBInspectable
open var pulseOpacity: CGFloat {
get {
return pulse.opacity
}
set(value) {
pulse.opacity = value
}
}
/** /**
Triggers the pulse animation. Triggers the pulse animation.
......
...@@ -413,7 +413,7 @@ open class Switch: UIControl { ...@@ -413,7 +413,7 @@ open class Switch: UIControl {
/// Prepares the button. /// Prepares the button.
private func prepareButton() { private func prepareButton() {
button.pulse.animation = .none button.pulseAnimation = .none
button.addTarget(self, action: #selector(handleTouchUpInside), for: .touchUpInside) button.addTarget(self, action: #selector(handleTouchUpInside), for: .touchUpInside)
button.addTarget(self, action: #selector(handleTouchDragInside), for: .touchDragInside) button.addTarget(self, action: #selector(handleTouchDragInside), for: .touchDragInside)
button.addTarget(self, action: #selector(handleTouchUpOutsideOrCanceled), for: .touchCancel) button.addTarget(self, action: #selector(handleTouchUpOutsideOrCanceled), for: .touchCancel)
......
...@@ -40,8 +40,39 @@ open class TableViewCell: UITableViewCell { ...@@ -40,8 +40,39 @@ open class TableViewCell: UITableViewCell {
open private(set) lazy var visualLayer = CAShapeLayer() open private(set) lazy var visualLayer = CAShapeLayer()
/// A Pulse reference. /// A Pulse reference.
internal private(set) lazy var pulse: Pulse = Pulse()
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
get {
return pulse.animation
}
set(value) {
pulse.animation = value
}
}
/// PulseAnimation color.
@IBInspectable @IBInspectable
open internal(set) lazy var pulse: Pulse = Pulse() open var pulseColor: UIColor {
get {
return pulse.color
}
set(value) {
pulse.color = value
}
}
/// Pulse opacity.
@IBInspectable
open var pulseOpacity: CGFloat {
get {
return pulse.opacity
}
set(value) {
pulse.opacity = value
}
}
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
@IBInspectable @IBInspectable
......
...@@ -207,7 +207,7 @@ open class TextField: UITextField { ...@@ -207,7 +207,7 @@ open class TextField: UITextField {
if nil == clearIconButton { if nil == clearIconButton {
clearIconButton = IconButton(image: Icon.cm.clear, tintColor: placeholderColor) clearIconButton = IconButton(image: Icon.cm.clear, tintColor: placeholderColor)
clearIconButton!.contentEdgeInsets = .zero clearIconButton!.contentEdgeInsets = .zero
clearIconButton!.pulse.animation = .center clearIconButton!.pulseAnimation = .center
clearButtonMode = .never clearButtonMode = .never
rightViewMode = .whileEditing rightViewMode = .whileEditing
rightView = clearIconButton rightView = clearIconButton
...@@ -242,7 +242,7 @@ open class TextField: UITextField { ...@@ -242,7 +242,7 @@ open class TextField: UITextField {
if nil == visibilityIconButton { if nil == visibilityIconButton {
visibilityIconButton = IconButton(image: Icon.visibility, tintColor: placeholderColor.withAlphaComponent(isSecureTextEntry ? 0.38 : 0.54)) visibilityIconButton = IconButton(image: Icon.visibility, tintColor: placeholderColor.withAlphaComponent(isSecureTextEntry ? 0.38 : 0.54))
visibilityIconButton!.contentEdgeInsets = .zero visibilityIconButton!.contentEdgeInsets = .zero
visibilityIconButton!.pulse.animation = .center visibilityIconButton!.pulseAnimation = .center
isSecureTextEntry = true isSecureTextEntry = true
clearButtonMode = .never clearButtonMode = .never
rightViewMode = .whileEditing rightViewMode = .whileEditing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment