Commit 54b91588 by Daniel Dahan

updated Pulse and Divider to be accessible through Storyboards

parent ed5c1030
...@@ -58,12 +58,12 @@ class ViewController: UIViewController { ...@@ -58,12 +58,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() {
......
...@@ -80,7 +80,7 @@ class ViewController: UIViewController { ...@@ -80,7 +80,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)
......
...@@ -2,6 +2,16 @@ ...@@ -2,6 +2,16 @@
"images" : [ "images" : [
{ {
"idiom" : "iphone", "idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29", "size" : "29x29",
"scale" : "2x" "scale" : "2x"
}, },
...@@ -32,6 +42,16 @@ ...@@ -32,6 +42,16 @@
}, },
{ {
"idiom" : "ipad", "idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29", "size" : "29x29",
"scale" : "1x" "scale" : "1x"
}, },
...@@ -59,6 +79,11 @@ ...@@ -59,6 +79,11 @@
"idiom" : "ipad", "idiom" : "ipad",
"size" : "76x76", "size" : "76x76",
"scale" : "2x" "scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
} }
], ],
"info" : { "info" : {
......
...@@ -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)
} }
......
...@@ -14,6 +14,19 @@ ...@@ -14,6 +14,19 @@
9A0572981D99E64100341332 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A0572961D99E64100341332 /* LaunchScreen.storyboard */; }; 9A0572981D99E64100341332 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A0572961D99E64100341332 /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */ /* 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 */ /* Begin PBXFileReference section */
9A05728A1D99E64100341332 /* Button.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Button.app; sourceTree = BUILT_PRODUCTS_DIR; }; 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>"; }; 9A05728D1D99E64100341332 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
...@@ -74,6 +87,7 @@ ...@@ -74,6 +87,7 @@
9A0572861D99E64100341332 /* Sources */, 9A0572861D99E64100341332 /* Sources */,
9A0572871D99E64100341332 /* Frameworks */, 9A0572871D99E64100341332 /* Frameworks */,
9A0572881D99E64100341332 /* Resources */, 9A0572881D99E64100341332 /* Resources */,
9690B4151D99FF2700E7F42A /* Embed Frameworks */,
); );
buildRules = ( buildRules = (
); );
...@@ -96,7 +110,6 @@ ...@@ -96,7 +110,6 @@
TargetAttributes = { TargetAttributes = {
9A0572891D99E64100341332 = { 9A0572891D99E64100341332 = {
CreatedOnToolsVersion = 8.0; CreatedOnToolsVersion = 8.0;
DevelopmentTeam = 5YZ5P93LKC;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
}; };
...@@ -259,7 +272,7 @@ ...@@ -259,7 +272,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 5YZ5P93LKC; DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Button/Info.plist; INFOPLIST_FILE = Button/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Button; PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Button;
...@@ -272,7 +285,7 @@ ...@@ -272,7 +285,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 5YZ5P93LKC; DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Button/Info.plist; INFOPLIST_FILE = Button/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Button; PRODUCT_BUNDLE_IDENTIFIER = com.cosmicmind.Button;
......
...@@ -32,36 +32,24 @@ import UIKit ...@@ -32,36 +32,24 @@ import UIKit
import Material import Material
class ViewController: UIViewController { class ViewController: UIViewController {
// ivars
@IBOutlet weak var fabButton: FabButton! @IBOutlet weak var fabButton: FabButton!
@IBOutlet weak var iconButton: IconButton! @IBOutlet weak var iconButton: IconButton!
/**
@name viewDidLoad()
*/
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareFabButton() prepareFabButton()
prepareIconButton() prepareIconButton()
} }
}
// Preparation
extension ViewController {
/**
@name prepareFabButton()
*/
func prepareFabButton() { func prepareFabButton() {
fabButton.setImage(Icon.edit, for: .normal) fabButton.image = Icon.cm.add
fabButton.pulseColor = Color.white
} }
/**
@name prepareIconButton()
*/
func prepareIconButton() { func prepareIconButton() {
iconButton.setImage(Icon.search, for: .normal) 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