diff --git a/Example/SCLAlertViewExample.xcodeproj/project.pbxproj b/Example/SCLAlertViewExample.xcodeproj/project.pbxproj index 285423a..4ffbfe7 100644 --- a/Example/SCLAlertViewExample.xcodeproj/project.pbxproj +++ b/Example/SCLAlertViewExample.xcodeproj/project.pbxproj @@ -167,7 +167,9 @@ CEABB2391942AD9700FCB13C /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0600; + LastSwiftMigration = 0700; + LastSwiftUpdateCheck = 0700; + LastUpgradeCheck = 0700; ORGANIZATIONNAME = "Viktor Radchenko"; TargetAttributes = { CEABB2401942AD9700FCB13C = { @@ -268,6 +270,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -332,6 +335,7 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; INFOPLIST_FILE = SCLAlertViewExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "SIX-DAYS-LLC.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -344,6 +348,7 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; INFOPLIST_FILE = SCLAlertViewExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "SIX-DAYS-LLC.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -364,6 +369,7 @@ INFOPLIST_FILE = SCLAlertViewExampleTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "SIX-DAYS-LLC.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; }; @@ -380,6 +386,7 @@ INFOPLIST_FILE = SCLAlertViewExampleTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "SIX-DAYS-LLC.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; }; diff --git a/Example/SCLAlertViewExample.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate b/Example/SCLAlertViewExample.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..ff9697f Binary files /dev/null and b/Example/SCLAlertViewExample.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Example/SCLAlertViewExample.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/SCLAlertViewExample.xcscheme b/Example/SCLAlertViewExample.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/SCLAlertViewExample.xcscheme new file mode 100644 index 0000000..cfcb4c4 --- /dev/null +++ b/Example/SCLAlertViewExample.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/SCLAlertViewExample.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/SCLAlertViewExample.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist b/Example/SCLAlertViewExample.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..f066c8d --- /dev/null +++ b/Example/SCLAlertViewExample.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + SCLAlertViewExample.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + CEABB2401942AD9700FCB13C + + primary + + + CEABB2541942AD9700FCB13C + + primary + + + + + diff --git a/Example/SCLAlertViewExample/Info.plist b/Example/SCLAlertViewExample/Info.plist index 5102da9..15ef4cf 100644 --- a/Example/SCLAlertViewExample/Info.plist +++ b/Example/SCLAlertViewExample/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - SIX-DAYS-LLC.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Example/SCLAlertViewExample/SCLAlertView.swift b/Example/SCLAlertViewExample/SCLAlertView.swift index 7b0a819..8ec3c70 100644 --- a/Example/SCLAlertViewExample/SCLAlertView.swift +++ b/Example/SCLAlertViewExample/SCLAlertView.swift @@ -30,7 +30,7 @@ public class SCLButton: UIButton { super.init(frame: CGRectZero) } - required public init(coder aDecoder: NSCoder) { + required public init?(coder aDecoder: NSCoder) { super.init(coder:aDecoder) } @@ -100,7 +100,7 @@ public class SCLAlertView: UIViewController { private var inputs = [UITextField]() private var buttons = [SCLButton]() - required public init(coder aDecoder: NSCoder) { + required public init?(coder aDecoder: NSCoder) { fatalError("NSCoding not supported") } @@ -108,7 +108,7 @@ public class SCLAlertView: UIViewController { super.init(nibName:nil, bundle:nil) // Set up main view view.frame = UIScreen.mainScreen().bounds - view.autoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth + view.autoresizingMask = [UIViewAutoresizing.FlexibleHeight, UIViewAutoresizing.FlexibleWidth] view.backgroundColor = UIColor(red:0, green:0, blue:0, alpha:kDefaultShadowOpacity) view.addSubview(baseView) // Base View @@ -126,7 +126,7 @@ public class SCLAlertView: UIViewController { circleBG.layer.cornerRadius = circleBG.frame.size.height / 2 baseView.addSubview(circleBG) circleBG.addSubview(circleView) - var x = (kCircleHeightBackground - kCircleHeight) / 2 + let x = (kCircleHeightBackground - kCircleHeight) / 2 circleView.frame = CGRect(x:x, y:x, width:kCircleHeight, height:kCircleHeight) circleView.layer.cornerRadius = circleView.frame.size.height / 2 // Title @@ -194,8 +194,8 @@ public class SCLAlertView: UIViewController { } } - override public func touchesEnded(touches:Set, withEvent event:UIEvent) { - if event.touchesForView(view)?.count > 0 { + override public func touchesEnded(touches:Set, withEvent event:UIEvent?) { + if event?.touchesForView(view)?.count > 0 { view.endEditing(true) } } @@ -224,8 +224,8 @@ public class SCLAlertView: UIViewController { btn.actionType = SCLActionType.Closure btn.action = action btn.addTarget(self, action:Selector("buttonTapped:"), forControlEvents:.TouchUpInside) - btn.addTarget(self, action:Selector("buttonTapDown:"), forControlEvents:.TouchDown | .TouchDragEnter) - btn.addTarget(self, action:Selector("buttonRelease:"), forControlEvents:.TouchUpInside | .TouchUpOutside | .TouchCancel | .TouchDragOutside ) + btn.addTarget(self, action:Selector("buttonTapDown:"), forControlEvents:[.TouchDown, .TouchDragEnter]) + btn.addTarget(self, action:Selector("buttonRelease:"), forControlEvents:[.TouchUpInside, .TouchUpOutside, .TouchCancel, .TouchDragOutside] ) return btn } @@ -235,8 +235,8 @@ public class SCLAlertView: UIViewController { btn.target = target btn.selector = selector btn.addTarget(self, action:Selector("buttonTapped:"), forControlEvents:.TouchUpInside) - btn.addTarget(self, action:Selector("buttonTapDown:"), forControlEvents:.TouchDown | .TouchDragEnter) - btn.addTarget(self, action:Selector("buttonRelease:"), forControlEvents:.TouchUpInside | .TouchUpOutside | .TouchCancel | .TouchDragOutside ) + btn.addTarget(self, action:Selector("buttonTapDown:"), forControlEvents:[.TouchDown, .TouchDragEnter]) + btn.addTarget(self, action:Selector("buttonRelease:"), forControlEvents:[.TouchUpInside, .TouchUpOutside, .TouchCancel, .TouchDragOutside] ) return btn } @@ -261,7 +261,7 @@ public class SCLAlertView: UIViewController { ctrl.sendAction(btn.selector, to:btn.target, forEvent:nil) return } else { - println("Unknow action type for button") + print("Unknow action type for button") } hideView() } @@ -377,9 +377,9 @@ public class SCLAlertView: UIViewController { viewText.text = subTitle // Adjust text view size, if necessary let str = subTitle as NSString - let attr = [NSFontAttributeName:viewText.font] + let attr = [NSFontAttributeName:viewText.font] as [String: AnyObject!] let sz = CGSize(width: kWindowWidth - 24, height:90) - let r = str.boundingRectWithSize(sz, options: NSStringDrawingOptions.UsesLineFragmentOrigin, attributes:attr, context:nil) + let r = str.boundingRectWithSize(sz, options: NSStringDrawingOptions.UsesLineFragmentOrigin, attributes: attr, context: nil) let ht = ceil(r.size.height) if ht < kTextHeight { kWindowHeight -= (kTextHeight - ht) @@ -487,7 +487,7 @@ class SCLAlertViewStyleKit : NSObject { // Drawing Methods class func drawCheckmark() { // Checkmark Shape Drawing - var checkmarkShapePath = UIBezierPath() + let checkmarkShapePath = UIBezierPath() checkmarkShapePath.moveToPoint(CGPointMake(73.25, 14.05)) checkmarkShapePath.addCurveToPoint(CGPointMake(64.51, 13.86), controlPoint1: CGPointMake(70.98, 11.44), controlPoint2: CGPointMake(66.78, 11.26)) checkmarkShapePath.addLineToPoint(CGPointMake(27.46, 52)) @@ -508,13 +508,13 @@ class SCLAlertViewStyleKit : NSObject { class func drawCross() { // Cross Shape Drawing - var crossShapePath = UIBezierPath() + let crossShapePath = UIBezierPath() crossShapePath.moveToPoint(CGPointMake(10, 70)) crossShapePath.addLineToPoint(CGPointMake(70, 10)) crossShapePath.moveToPoint(CGPointMake(10, 10)) crossShapePath.addLineToPoint(CGPointMake(70, 70)) - crossShapePath.lineCapStyle = kCGLineCapRound; - crossShapePath.lineJoinStyle = kCGLineJoinRound; + crossShapePath.lineCapStyle = CGLineCap.Round; + crossShapePath.lineJoinStyle = CGLineJoin.Round; UIColor.whiteColor().setStroke() crossShapePath.lineWidth = 14 crossShapePath.stroke() @@ -522,7 +522,7 @@ class SCLAlertViewStyleKit : NSObject { class func drawNotice() { // Notice Shape Drawing - var noticeShapePath = UIBezierPath() + let noticeShapePath = UIBezierPath() noticeShapePath.moveToPoint(CGPointMake(72, 48.54)) noticeShapePath.addLineToPoint(CGPointMake(72, 39.9)) noticeShapePath.addCurveToPoint(CGPointMake(66.38, 34.01), controlPoint1: CGPointMake(72, 36.76), controlPoint2: CGPointMake(69.48, 34.01)) @@ -563,7 +563,7 @@ class SCLAlertViewStyleKit : NSObject { // Warning Group // Warning Circle Drawing - var warningCirclePath = UIBezierPath() + let warningCirclePath = UIBezierPath() warningCirclePath.moveToPoint(CGPointMake(40.94, 63.39)) warningCirclePath.addCurveToPoint(CGPointMake(36.03, 65.55), controlPoint1: CGPointMake(39.06, 63.39), controlPoint2: CGPointMake(37.36, 64.18)) warningCirclePath.addCurveToPoint(CGPointMake(34.14, 70.45), controlPoint1: CGPointMake(34.9, 66.92), controlPoint2: CGPointMake(34.14, 68.49)) @@ -581,7 +581,7 @@ class SCLAlertViewStyleKit : NSObject { // Warning Shape Drawing - var warningShapePath = UIBezierPath() + let warningShapePath = UIBezierPath() warningShapePath.moveToPoint(CGPointMake(46.23, 4.26)) warningShapePath.addCurveToPoint(CGPointMake(40.94, 2.5), controlPoint1: CGPointMake(44.91, 3.09), controlPoint2: CGPointMake(43.02, 2.5)) warningShapePath.addCurveToPoint(CGPointMake(34.71, 4.26), controlPoint1: CGPointMake(38.68, 2.5), controlPoint2: CGPointMake(36.03, 3.09)) @@ -605,7 +605,7 @@ class SCLAlertViewStyleKit : NSObject { let color0 = UIColor(red: 1.000, green: 1.000, blue: 1.000, alpha: 1.000) // Info Shape Drawing - var infoShapePath = UIBezierPath() + let infoShapePath = UIBezierPath() infoShapePath.moveToPoint(CGPointMake(45.66, 15.96)) infoShapePath.addCurveToPoint(CGPointMake(45.66, 5.22), controlPoint1: CGPointMake(48.78, 12.99), controlPoint2: CGPointMake(48.78, 8.19)) infoShapePath.addCurveToPoint(CGPointMake(34.34, 5.22), controlPoint1: CGPointMake(42.53, 2.26), controlPoint2: CGPointMake(37.47, 2.26)) @@ -631,7 +631,7 @@ class SCLAlertViewStyleKit : NSObject { let color = UIColor(red:1.0, green:1.0, blue:1.0, alpha:1.0) // Edit shape Drawing - var editPathPath = UIBezierPath() + let editPathPath = UIBezierPath() editPathPath.moveToPoint(CGPointMake(71, 2.7)) editPathPath.addCurveToPoint(CGPointMake(71.9, 15.2), controlPoint1: CGPointMake(74.7, 5.9), controlPoint2: CGPointMake(75.1, 11.6)) editPathPath.addLineToPoint(CGPointMake(64.5, 23.7)) diff --git a/Example/SCLAlertViewExample/ViewController.swift b/Example/SCLAlertViewExample/ViewController.swift index 903ebc3..369cdbc 100644 --- a/Example/SCLAlertViewExample/ViewController.swift +++ b/Example/SCLAlertViewExample/ViewController.swift @@ -34,7 +34,7 @@ class ViewController: UIViewController { let alert = SCLAlertView() alert.addButton("First Button", target:self, selector:Selector("firstButton")) alert.addButton("Second Button") { - println("Second button tapped") + print("Second button tapped") } alert.showSuccess(kSuccessTitle, subTitle: kSubtitle) } @@ -58,14 +58,14 @@ class ViewController: UIViewController { @IBAction func showEdit(sender: AnyObject) { let alert = SCLAlertView() - let txt = alert.addTextField(title:"Enter your name") + let txt = alert.addTextField("Enter your name") alert.addButton("Show Name") { - println("Text value: \(txt.text)") + print("Text value: \(txt.text)") } alert.showEdit(kInfoTitle, subTitle:kSubtitle) } func firstButton() { - println("First button tapped") + print("First button tapped") } } diff --git a/Example/SCLAlertViewExampleTests/Info.plist b/Example/SCLAlertViewExampleTests/Info.plist index 32b5fe2..6d32c15 100644 --- a/Example/SCLAlertViewExampleTests/Info.plist +++ b/Example/SCLAlertViewExampleTests/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - SIX-DAYS-LLC.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/SCLAlertView.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate b/SCLAlertView.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..c7d60ed Binary files /dev/null and b/SCLAlertView.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SCLAlertView.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist b/SCLAlertView.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..53ea0a1 --- /dev/null +++ b/SCLAlertView.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,19 @@ + + + + + SuppressBuildableAutocreation + + 70264EF61B0F588700B32B18 + + primary + + + 70264F011B0F588800B32B18 + + primary + + + + +