Commit 7407d97f by Daniel Dahan

Swift 2.3 progression commit

parent f778d3dc
...@@ -56,9 +56,9 @@ public class Button: UIButton { ...@@ -56,9 +56,9 @@ public class Button: UIButton {
@IBInspectable public var pulseColor: UIColor = Color.grey.base @IBInspectable public var pulseColor: UIColor = Color.grey.base
/// The type of PulseAnimation. /// The type of PulseAnimation.
public var pulseAnimation: PulseAnimation = .AtPointWithBacking { public var pulseAnimation: PulseAnimation = .pointWithBacking {
didSet { didSet {
visualLayer.masksToBounds = .CenterRadialBeyondBounds != pulseAnimation visualLayer.masksToBounds = .centerRadialBeyondBounds != pulseAnimation
} }
} }
......
...@@ -141,7 +141,7 @@ public extension UIImage { ...@@ -141,7 +141,7 @@ public extension UIImage {
// Add in color tint. // Add in color tint.
if let v: UIColor = tintColor { if let v: UIColor = tintColor {
CGContextSaveGState(outputContext) CGContextSaveGState(outputContext)
CGContextSetFillColorWithColor(outputContext, v.CGColor) CGContextSetFillColorWithColor(outputContext, v.cgColor)
CGContextFillRect(outputContext, imageRect) CGContextFillRect(outputContext, imageRect)
CGContextRestoreGState(outputContext) CGContextRestoreGState(outputContext)
} }
......
...@@ -36,9 +36,9 @@ public extension MaterialAnimation { ...@@ -36,9 +36,9 @@ public extension MaterialAnimation {
*/ */
public static func backgroundColor(color: UIColor, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func backgroundColor(color: UIColor, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "backgroundColor") let animation: CABasicAnimation = CABasicAnimation(keyPath: "backgroundColor")
animation.toValue = color.CGColor animation.toValue = color.cgColor
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = MaterialAnimationFillModeToValue(mode: .Forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -53,7 +53,7 @@ public extension MaterialAnimation { ...@@ -53,7 +53,7 @@ public extension MaterialAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "cornerRadius") let animation: CABasicAnimation = CABasicAnimation(keyPath: "cornerRadius")
animation.toValue = radius animation.toValue = radius
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = MaterialAnimationFillModeToValue(.Forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -68,7 +68,7 @@ public extension MaterialAnimation { ...@@ -68,7 +68,7 @@ public extension MaterialAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform")
animation.toValue = NSValue(CATransform3D: transform) animation.toValue = NSValue(CATransform3D: transform)
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = MaterialAnimationFillModeToValue(.Forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
......
...@@ -56,9 +56,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -56,9 +56,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
@IBInspectable public var pulseColor: UIColor = Color.grey.base @IBInspectable public var pulseColor: UIColor = Color.grey.base
/// The type of PulseAnimation. /// The type of PulseAnimation.
public var pulseAnimation: PulseAnimation = .AtPointWithBacking { public var pulseAnimation: PulseAnimation = .pointWithBacking {
didSet { didSet {
visualLayer.masksToBounds = .CenterRadialBeyondBounds != pulseAnimation visualLayer.masksToBounds = .centerRadialBeyondBounds != pulseAnimation
} }
} }
...@@ -187,7 +187,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -187,7 +187,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
@IBInspectable public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
...@@ -250,7 +250,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -250,7 +250,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
@IBInspectable public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.cgColor
} }
} }
...@@ -366,7 +366,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -366,7 +366,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
/// A preset property to set the borderWidth. /// A preset property to set the borderWidth.
public var borderWidthPreset: MaterialBorder = .None { public var borderWidthPreset: MaterialBorder = .None {
didSet { didSet {
borderWidth = MaterialBorderToValue(borderWidthPreset) borderWidth = MaterialBorderToValue(border: borderWidthPreset)
} }
} }
...@@ -383,10 +383,10 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -383,10 +383,10 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
@IBInspectable public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(cgColor: layer.borderColor!)
} }
set(value) { set(value) {
layer.borderColor = value?.CGColor layer.borderColor = value?.cgColor
} }
} }
...@@ -415,7 +415,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -415,7 +415,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
- Parameter aDecoder: A NSCoder instance. - Parameter aDecoder: A NSCoder instance.
*/ */
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
depth = .None depthPreset = .none
cornerRadiusPreset = .None cornerRadiusPreset = .None
shape = .None shape = .None
contentsGravityPreset = .ResizeAspectFill contentsGravityPreset = .ResizeAspectFill
...@@ -430,7 +430,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -430,7 +430,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
- Parameter frame: A CGRect instance. - Parameter frame: A CGRect instance.
*/ */
public override init(frame: CGRect) { public override init(frame: CGRect) {
depth = .None depthPreset = .none
cornerRadiusPreset = .None cornerRadiusPreset = .None
shape = .None shape = .None
contentsGravityPreset = .ResizeAspectFill contentsGravityPreset = .ResizeAspectFill
...@@ -443,8 +443,8 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -443,8 +443,8 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
self.init(frame: CGRect.zero) self.init(frame: CGRect.zero)
} }
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayers(of layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayers(of: layer)
if self.layer == layer { if self.layer == layer {
layoutShape() layoutShape()
layoutVisualLayer() layoutVisualLayer()
...@@ -498,7 +498,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -498,7 +498,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
if let v: AnyObject = b.toValue { if let v: AnyObject = b.toValue {
if let k: String = b.keyPath { if let k: String = b.keyPath {
layer.setValue(v, forKeyPath: k) layer.setValue(v, forKeyPath: k)
layer.removeAnimationForKey(k) layer.removeAnimation(forKey: k)
} }
} }
} }
...@@ -531,9 +531,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -531,9 +531,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
- Parameter touches: A set of UITouch objects. - Parameter touches: A set of UITouch objects.
- Parameter event: A UIEvent object. - Parameter event: A UIEvent object.
*/ */
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesBegan(touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, withEvent: event) super.touchesBegan(touches, with: event)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -542,9 +542,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -542,9 +542,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
- Parameter touches: A set of UITouch objects. - Parameter touches: A set of UITouch objects.
- Parameter event: A UIEvent object. - Parameter event: A UIEvent object.
*/ */
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesEnded(touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, withEvent: event) super.touchesEnded(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -553,9 +553,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -553,9 +553,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
- Parameter touches: A set of UITouch objects. - Parameter touches: A set of UITouch objects.
- Parameter event: A UIEvent object. - Parameter event: A UIEvent object.
*/ */
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) { public override func touchesCancelled(touches: Set<UITouch>, with event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event) super.touchesCancelled(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -567,7 +567,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -567,7 +567,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
*/ */
public func prepareView() { public func prepareView() {
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
pulseAnimation = .None pulseAnimation = .none
prepareVisualLayer() prepareVisualLayer()
} }
...@@ -597,12 +597,12 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -597,12 +597,12 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
/// Sets the shadow path. /// Sets the shadow path.
internal func layoutShadowPath() { internal func layoutShadowPath() {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
if .None == depth { if .none == depthPreset {
shadowPath = nil shadowPath = nil
} else if nil == shadowPath { } else if nil == shadowPath {
shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).CGPath shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
} else { } else {
animate(MaterialAnimation.shadowPath(UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).CGPath, duration: 0)) animate(animation: MaterialAnimation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0))
} }
} }
} }
......
...@@ -56,9 +56,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -56,9 +56,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
@IBInspectable public var pulseColor: UIColor = Color.grey.base @IBInspectable public var pulseColor: UIColor = Color.grey.base
/// The type of PulseAnimation. /// The type of PulseAnimation.
public var pulseAnimation: PulseAnimation = .AtPointWithBacking { public var pulseAnimation: PulseAnimation = .pointWithBacking {
didSet { didSet {
visualLayer.masksToBounds = .CenterRadialBeyondBounds != pulseAnimation visualLayer.masksToBounds = .centerRadialBeyondBounds != pulseAnimation
} }
} }
...@@ -187,7 +187,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -187,7 +187,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
@IBInspectable public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
...@@ -250,7 +250,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -250,7 +250,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
@IBInspectable public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.cgColor
} }
} }
...@@ -383,10 +383,10 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -383,10 +383,10 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
@IBInspectable public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(cgColor: layer.borderColor!)
} }
set(value) { set(value) {
layer.borderColor = value?.CGColor layer.borderColor = value?.cgColor
} }
} }
......
...@@ -55,9 +55,9 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -55,9 +55,9 @@ public class MaterialTableViewCell : UITableViewCell {
@IBInspectable public var pulseColor: UIColor = Color.grey.base @IBInspectable public var pulseColor: UIColor = Color.grey.base
/// The type of PulseAnimation. /// The type of PulseAnimation.
public var pulseAnimation: PulseAnimation = .AtPointWithBacking { public var pulseAnimation: PulseAnimation = .pointWithBacking {
didSet { didSet {
visualLayer.masksToBounds = .CenterRadialBeyondBounds != pulseAnimation visualLayer.masksToBounds = .centerRadialBeyondBounds != pulseAnimation
} }
} }
...@@ -79,7 +79,7 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -79,7 +79,7 @@ public class MaterialTableViewCell : UITableViewCell {
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
@IBInspectable public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
...@@ -136,7 +136,7 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -136,7 +136,7 @@ public class MaterialTableViewCell : UITableViewCell {
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
@IBInspectable public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.cgColor
} }
} }
...@@ -189,17 +189,22 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -189,17 +189,22 @@ public class MaterialTableViewCell : UITableViewCell {
} }
} }
/// A preset value for Depth.
public var depthPreset: DepthPreset = .none {
didSet {
depth = DepthPresetToValue(preset: depthPreset)
}
}
/** /**
A property that sets the shadowOffset, shadowOpacity, and shadowRadius A property that sets the shadowOffset, shadowOpacity, and shadowRadius
for the backing layer. This is the preferred method of setting depth for the backing layer.
in order to maintain consitency across UI objects.
*/ */
public var depthPreset = .none { public var depth = Depth.zero {
didSet { didSet {
let value: Depth = DepthPresetToValue(preset) shadowOffset = depth.offset.asSize
shadowOffset = value.offset shadowOpacity = depth.opacity
shadowOpacity = value.opacity shadowRadius = depth.radius
shadowRadius = value.radius
layoutShadowPath() layoutShadowPath()
} }
} }
...@@ -212,7 +217,7 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -212,7 +217,7 @@ public class MaterialTableViewCell : UITableViewCell {
public var cornerRadiusPreset: MaterialRadius = .None { public var cornerRadiusPreset: MaterialRadius = .None {
didSet { didSet {
if let v: MaterialRadius = cornerRadiusPreset { if let v: MaterialRadius = cornerRadiusPreset {
cornerRadius = MaterialRadiusToValue(v) cornerRadius = MaterialRadiusToValue(radius: v)
} }
} }
} }
...@@ -231,7 +236,7 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -231,7 +236,7 @@ public class MaterialTableViewCell : UITableViewCell {
/// A preset property to set the borderWidth. /// A preset property to set the borderWidth.
public var borderWidthPreset: MaterialBorder = .None { public var borderWidthPreset: MaterialBorder = .None {
didSet { didSet {
borderWidth = MaterialBorderToValue(borderWidthPreset) borderWidth = MaterialBorderToValue(border: borderWidthPreset)
} }
} }
...@@ -248,10 +253,10 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -248,10 +253,10 @@ public class MaterialTableViewCell : UITableViewCell {
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
@IBInspectable public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(cgColor: layer.borderColor!)
} }
set(value) { set(value) {
layer.borderColor = value?.CGColor layer.borderColor = value?.cgColor
} }
} }
......
...@@ -66,7 +66,7 @@ public class MaterialTextLayer : CATextLayer { ...@@ -66,7 +66,7 @@ public class MaterialTextLayer : CATextLayer {
*/ */
@IBInspectable public var textColor: UIColor? { @IBInspectable public var textColor: UIColor? {
didSet { didSet {
foregroundColor = textColor?.CGColor foregroundColor = textColor?.cgColor
} }
} }
......
...@@ -187,7 +187,7 @@ public class NavigationBar : UINavigationBar { ...@@ -187,7 +187,7 @@ public class NavigationBar : UINavigationBar {
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
@IBInspectable public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.cgColor
} }
} }
...@@ -255,10 +255,10 @@ public class NavigationBar : UINavigationBar { ...@@ -255,10 +255,10 @@ public class NavigationBar : UINavigationBar {
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
@IBInspectable public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(cgColor: layer.borderColor!)
} }
set(value) { set(value) {
layer.borderColor = value?.CGColor layer.borderColor = value?.cgColor
} }
} }
......
...@@ -41,9 +41,9 @@ public class PulseView: View { ...@@ -41,9 +41,9 @@ public class PulseView: View {
@IBInspectable public var pulseColor: UIColor = Color.grey.base @IBInspectable public var pulseColor: UIColor = Color.grey.base
/// The type of PulseAnimation. /// The type of PulseAnimation.
public var pulseAnimation: PulseAnimation = .AtPointWithBacking { public var pulseAnimation: PulseAnimation = .pointWithBacking {
didSet { didSet {
visualLayer.masksToBounds = .CenterRadialBeyondBounds != pulseAnimation visualLayer.masksToBounds = .centerRadialBeyondBounds != pulseAnimation
} }
} }
......
...@@ -53,7 +53,7 @@ public class TextField : UITextField { ...@@ -53,7 +53,7 @@ public class TextField : UITextField {
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
@IBInspectable public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
...@@ -130,7 +130,7 @@ public class TextField : UITextField { ...@@ -130,7 +130,7 @@ public class TextField : UITextField {
@IBInspectable public var dividerColor: UIColor = Color.darkText.dividers { @IBInspectable public var dividerColor: UIColor = Color.darkText.dividers {
didSet { didSet {
if !editing { if !editing {
divider.backgroundColor = dividerColor.CGColor divider.backgroundColor = dividerColor.cgColor
} }
} }
} }
...@@ -140,7 +140,7 @@ public class TextField : UITextField { ...@@ -140,7 +140,7 @@ public class TextField : UITextField {
didSet { didSet {
if let v: UIColor = dividerActiveColor { if let v: UIColor = dividerActiveColor {
if editing { if editing {
divider.backgroundColor = v.CGColor divider.backgroundColor = v.cgColor
} }
} }
} }
...@@ -552,13 +552,13 @@ public class TextField : UITextField { ...@@ -552,13 +552,13 @@ public class TextField : UITextField {
/// The animation for the divider when editing begins. /// The animation for the divider when editing begins.
public func dividerEditingDidBeginAnimation() { public func dividerEditingDidBeginAnimation() {
divider.frame.size.height = dividerActiveHeight divider.frame.size.height = dividerActiveHeight
divider.backgroundColor = nil == dividerActiveColor ? placeholderActiveColor.CGColor : dividerActiveColor!.CGColor divider.backgroundColor = nil == dividerActiveColor ? placeholderActiveColor.cgColor : dividerActiveColor!.cgColor
} }
/// The animation for the divider when editing ends. /// The animation for the divider when editing ends.
public func dividerEditingDidEndAnimation() { public func dividerEditingDidEndAnimation() {
divider.frame.size.height = dividerHeight divider.frame.size.height = dividerHeight
divider.backgroundColor = dividerColor.CGColor divider.backgroundColor = dividerColor.cgColor
} }
/// The animation for the placeholder when editing begins. /// The animation for the placeholder when editing begins.
......
...@@ -52,7 +52,7 @@ public class TextView: UITextView { ...@@ -52,7 +52,7 @@ public class TextView: UITextView {
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
@IBInspectable public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
...@@ -99,7 +99,7 @@ public class TextView: UITextView { ...@@ -99,7 +99,7 @@ public class TextView: UITextView {
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
@IBInspectable public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.cgColor
} }
} }
...@@ -207,10 +207,10 @@ public class TextView: UITextView { ...@@ -207,10 +207,10 @@ public class TextView: UITextView {
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
@IBInspectable public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(cgColor: layer.borderColor!)
} }
set(value) { set(value) {
layer.borderColor = value?.CGColor layer.borderColor = value?.cgColor
} }
} }
......
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