diff --git a/C4/Core/Path.swift b/C4/Core/Path.swift index 2c898cd3..d94c75be 100644 --- a/C4/Core/Path.swift +++ b/C4/Core/Path.swift @@ -25,12 +25,12 @@ public enum FillRule { /// Specifies the non-zero winding rule. Count each left-to-right path as +1 and each right-to-left path as -1. If the /// sum of all crossings is 0, the point is outside the path. If the sum is nonzero, the point is inside the path and /// the region containing it is filled. - case NonZero + case nonZero /// Specifies the even-odd winding rule. Count the total number of path crossings. If the number of crossings is even, /// the point is outside the path. If the number of crossings is odd, the point is inside the path and the region /// containing it should be filled. - case EvenOdd + case evenOdd } /// A Path is a sequence of geometric segments which can be straight lines or curves. @@ -72,8 +72,8 @@ public class Path: Equatable { /// - parameter point: The point to test. /// - parameter fillRule: The fill rule to use when testing for containment. /// - returns: `true` if `point` is inside the path, `false` otherwise. - public func containsPoint(_ point: Point, fillRule: FillRule = .NonZero) -> Bool { - let rule = fillRule == .EvenOdd ? CGPathFillRule.evenOdd : CGPathFillRule.winding + public func containsPoint(_ point: Point, fillRule: FillRule = .nonZero) -> Bool { + let rule = fillRule == .evenOdd ? CGPathFillRule.evenOdd : CGPathFillRule.winding return internalPath.contains(CGPoint(point), using: rule, transform: CGAffineTransform.identity) } diff --git a/C4/UI/Animation.swift b/C4/UI/Animation.swift index 4c79fbac..92c321da 100644 --- a/C4/UI/Animation.swift +++ b/C4/UI/Animation.swift @@ -31,13 +31,13 @@ public class Animation { /// ```` public enum Curve { /// A linear animation curve causes an animation to occur evenly over its duration. - case Linear + case linear /// An ease-out curve causes the animation to begin quickly, and then slow down as it completes. - case EaseOut + case easeOut /// An ease-in curve causes the animation to begin slowly, and then speed up as it progresses. - case EaseIn + case easeIn /// An ease-in ease-out curve causes the animation to begin slowly, accelerate through the middle of its duration, and then slow again before completing. This is the default curve for most animations. - case EaseInOut + case easeInOut } /// Determines if the animation plays in the reverse upon completion. @@ -64,7 +64,7 @@ public class Animation { public var duration: TimeInterval = 1 /// The animation curve that the receiver will apply to the changes it is supposed to animate. - public var curve: Curve = .EaseInOut + public var curve: Curve = .easeInOut private var completionObservers: [AnyObject] = [] private var cancelObservers: [AnyObject] = [] diff --git a/C4/UI/Shape.swift b/C4/UI/Shape.swift index 4c49728c..d30fc591 100644 --- a/C4/UI/Shape.swift +++ b/C4/UI/Shape.swift @@ -67,8 +67,8 @@ open class Shape: View { strokeColor = C4Purple fillColor = C4Blue lineWidth = 1 - lineCap = .Round - lineJoin = .Round + lineCap = .round + lineJoin = .round let image = UIImage.createWithColor(UIColor.clear, size: CGSize(width: 1, height: 1)).cgImage shapeLayer.contents = image @@ -93,8 +93,8 @@ open class Shape: View { strokeColor = C4Purple fillColor = C4Blue lineWidth = 1 - lineCap = .Round - lineJoin = .Round + lineCap = .round + lineJoin = .round let image = UIImage.createWithColor(UIColor.clear, size: CGSize(width: 1, height: 1)).cgImage shapeLayer.contents = image @@ -212,23 +212,23 @@ open class Shape: View { } } - /// The fill rule used when filling the path. Defaults to `NonZero`. + /// The fill rule used when filling the path. Defaults to `nonZero`. public var fillRule: FillRule { get { switch shapeLayer.fillRule { case kCAFillRuleNonZero: - return .NonZero + return .nonZero case kCAFillRuleEvenOdd: - return .EvenOdd + return .evenOdd default: - return .NonZero + return .nonZero } } set(fillRule) { switch fillRule { - case .NonZero: + case .nonZero: shapeLayer.fillRule = kCAFillRuleNonZero - case .EvenOdd: + case .evenOdd: shapeLayer.fillRule = kCAFillRuleEvenOdd } } @@ -276,20 +276,20 @@ open class Shape: View { get { switch shapeLayer.lineCap { case kCALineCapRound: - return .Round + return .round case kCALineCapSquare: - return .Square + return .square default: - return .Butt + return .butt } } set(lineCap) { switch lineCap { - case .Butt: + case .butt: shapeLayer.lineCap = kCALineCapButt - case .Round: + case .round: shapeLayer.lineCap = kCALineCapRound - case .Square: + case .square: shapeLayer.lineCap = kCALineCapSquare } } @@ -300,20 +300,20 @@ open class Shape: View { get { switch shapeLayer.lineJoin { case kCALineJoinRound: - return .Round + return .round case kCALineJoinBevel: - return .Bevel + return .bevel default: - return .Miter + return .miter } } set(lineJoin) { switch lineJoin { - case .Miter: + case .miter: shapeLayer.lineJoin = kCALineJoinMiter - case .Round: + case .round: shapeLayer.lineJoin = kCALineJoinRound - case .Bevel: + case .bevel: shapeLayer.lineJoin = kCALineJoinBevel } } @@ -350,25 +350,25 @@ open class Shape: View { /// The join style for joints on the shape's path. public enum LineJoin { /// Specifies a miter line shape of the joints between connected segments of a stroked path. - case Miter + case miter /// Specifies a round line shape of the joints between connected segments of a stroked path. - case Round + case round /// Specifies a bevel line shape of the joints between connected segments of a stroked path. - case Bevel + case bevel } /// The cap style for the ends of the shape's path. public enum LineCap { /// Specifies a butt line cap style for endpoints for an open path when stroked. - case Butt + case butt /// Specifies a round line cap style for endpoints for an open path when stroked. - case Round + case round /// Specifies a square line cap style for endpoints for an open path when stroked. - case Square + case square } public override func hitTest(_ point: Point) -> Bool { diff --git a/C4/UI/StoredAnimation.swift b/C4/UI/StoredAnimation.swift index 8e62fa4d..b05f9f7f 100644 --- a/C4/UI/StoredAnimation.swift +++ b/C4/UI/StoredAnimation.swift @@ -37,16 +37,16 @@ public class StoredAnimation: Animation { var options: UIViewAnimationOptions = [UIViewAnimationOptions.beginFromCurrentState] switch curve { - case .Linear: + case .linear: options = [options, .curveLinear] timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) - case .EaseOut: + case .easeOut: options = [options, .curveEaseOut] timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) - case .EaseIn: + case .easeIn: options = [options, .curveEaseIn] timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn) - case .EaseInOut: + case .easeInOut: options = [options, .curveEaseIn, .curveEaseOut] timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) } diff --git a/C4/UI/ViewAnimation.swift b/C4/UI/ViewAnimation.swift index b0821650..97e9586b 100644 --- a/C4/UI/ViewAnimation.swift +++ b/C4/UI/ViewAnimation.swift @@ -94,13 +94,13 @@ public class ViewAnimation: Animation { /// Options are `Linear`, `EaseOut`, `EaseIn`, `EaseInOut` public var timingFunction: CAMediaTimingFunction { switch curve { - case .Linear: + case .linear: return CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) - case .EaseOut: + case .easeOut: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) - case .EaseIn: + case .easeIn: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn) - case .EaseInOut: + case .easeInOut: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) } } @@ -109,13 +109,13 @@ public class ViewAnimation: Animation { public var options: UIViewAnimationOptions { var options: UIViewAnimationOptions = [UIViewAnimationOptions.beginFromCurrentState] switch curve { - case .Linear: + case .linear: options = [options, .curveLinear] - case .EaseOut: + case .easeOut: options = [options, .curveEaseOut] - case .EaseIn: + case .easeIn: options = [options, .curveEaseIn] - case .EaseInOut: + case .easeInOut: options = [options, .curveEaseIn, .curveEaseOut] }