 import UIKit
 
-public struct RoundedResizingDirection : OptionSetType {
+public struct RoundedResizingDirection : OptionSet {
     public let rawValue: Int
     public init(rawValue: Int) {
         self.rawValue = rawValue
     }
     
-    public static let Horizontal = RoundedResizingDirection(rawValue: 0b1)
-    public static let Vertical = RoundedResizingDirection(rawValue: 0b10)
-    public static let Both: RoundedResizingDirection = [Horizontal, Vertical]
+    public static let horizontal = RoundedResizingDirection(rawValue: 0b1)
+    public static let vertical = RoundedResizingDirection(rawValue: 0b10)
+    public static let both: RoundedResizingDirection = [horizontal, vertical]
 }
 
 extension UIColor {

    // and the language does not allow this
    public static func imageWithRoundedCorners(roundedCorners: UIRectCorner, cornerRadius: CGFloat, resizingDirection: RoundedResizingDirection, foregroundColor: UIColor, backgroundColor: UIColor, borderColor: UIColor? = nil, borderWidth: CGFloat? = nil) -> UIImage {
        // We adjust all our values to be in 1.0-scale space so smaller radii are less aliased
        let screenScale = UIScreen.mainScreen().scale
        let scaledCornerRadius = cornerRadius * screenScale
        var scaledSize = CGSize(width: scaledCornerRadius*2.0, height: scaledCornerRadius*2.0)
        
        if resizingDirection.contains(.Horizontal) {
            scaledSize.width += screenScale
        }
        
        if resizingDirection.contains(.Vertical) {
            scaledSize.height += screenScale
        }
        

            return (CGPoint(), CGPoint(), CGPoint())
        }
        
        for corner in [.topLeft, .topRight, .bottomRight, .bottomLeft] as [UIRectCorner] {
            let (startPoint, cornerPoint, endPoint) = pointsForCorner(corner: corner)
            if path.isEmpty {
                path.move(to: startPoint)
            }
            
            if corners.contains(corner) && cornerRadius > 0 {
                path.addArc(tangent1End: cornerPoint, tangent2End: endPoint, radius: cornerRadius)
            } else {
                path.addLine(to: cornerPoint)
                path.addLine(to: endPoint)
            }
        }
        
        path.closeSubpath()
        
        self.init(cgPath: path)
    }
}
