From dbc3d12de8b705c8a647cdd1bc2acdd4fdbb11af Mon Sep 17 00:00:00 2001 From: Calvin Cheng Date: Sat, 8 Aug 2015 00:53:41 +0800 Subject: [PATCH] Convert to Swift 2 --- .../project.pbxproj | 9 +- .../UserInterfaceState.xcuserstate | Bin 0 -> 12325 bytes .../xcschemes/SCLAlertViewExample.xcscheme | 101 ++++++++++++++++++ .../xcschemes/xcschememanagement.plist | 27 +++++ Example/SCLAlertViewExample/Info.plist | 2 +- .../SCLAlertViewExample/SCLAlertView.swift | 44 ++++---- .../SCLAlertViewExample/ViewController.swift | 8 +- Example/SCLAlertViewExampleTests/Info.plist | 2 +- .../UserInterfaceState.xcuserstate | Bin 0 -> 7493 bytes .../xcschemes/xcschememanagement.plist | 19 ++++ 10 files changed, 183 insertions(+), 29 deletions(-) create mode 100644 Example/SCLAlertViewExample.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 Example/SCLAlertViewExample.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/SCLAlertViewExample.xcscheme create mode 100644 Example/SCLAlertViewExample.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 SCLAlertView.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 SCLAlertView.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist 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 0000000000000000000000000000000000000000..ff9697f994da4006f4e0376c90d9330e03118758 GIT binary patch literal 12325 zcmb_icYKr8*S{l8o7tyLvzlhKX;W5rp)DeI3jzgcDWgD0n}-reo06mq5xEfo5fL1? z2eb&HqBs!;;KG56?VboSL_~is9PfGZG^N3!{_(b-HhG?V@45G$d+zsq&$+j;&FcvS zb9472j0mDgf?|+VB9|y8q|f2~0gtbBLb|VUCf^hcOiXwAn`U_6bzOSU*OrLz(zTB! z;A|9&;*bU=rQy-dICL(o{L;BGzCNPQmFo13Pdw z&cV4j4_}Ih;o{FXYlj*75pmRh2O#N;`i_#ycZwBAK|a@5qun< z#^2-r;h*qt_)kIzB@!YhDw04FiG^5+jiiz^l1*|*F3BVLWFWbS3?Ubj3Nnn0A(xYh zWD=Q5+{8m>6F&)%1>{PykSrmq$Qp77xrf|K?jxP#0rD`}LY^eM$ZO?UuK zx5**$KKX!rLB1wO$Z>Lld{54hpU9t-(pajbiBv~ZsFh~WzO)}5M2l!KEun+yMRW+g zm{!oybPTPd6X_({NSmme&ZM)bmogfnSJTDx8oGoorOW8GbUD3_uAtY`mGm}xJH3P6 zNjvDnbTfT~K1#RH$LQnqdHMp~PIu5Z=$mvmeTyEXhv@tCWBNHgO~0pS=nwQq`ak+B z{hj_n|D=CO=(zOOcCU9Ik|8-#ASH@NiQ{W(vuE-11C!vh%QEZJo4l?-paZFpnh{1j z5Qh?&guTu(oLqW-*`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w1+Be#_*q?D^ zI{G;Z9A%DSj?s?E4v)j@@HzaBcE>!&0>`zE6^@mT)sCATYaF*Z?r>~(e3hxnEXpj+ z9G-c3=A_IinbR{{GX0rLGq26OH*;g=gP9L!K9adLb7$sDnXhE-%6vWZ&CHK8zsNi) S(mX=MPl>vV_H}(^9{WEP`#MPg literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..c7d60ed57696403918ad8efd5454d1f67e2b2861 GIT binary patch literal 7493 zcma)A34Bvk)<5TFdr4lBm%Ngcy`>9lOX)&e5a=#QDWz#k*$ip&D37K|$pVx`FUYuy z3vRe}K^7HJN5%#H6m=YDMn(l0XLM9#6!&G+QAb7RzPzS1!spoj+T^`^?m6e4<$umS zt(^fm63xqd1rP{mKnpt1lM4xL$y_6aBXTI%k{N1UCHbO}MVa2PZ>7v$H)cjdoesc@ zyY~xEfB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6P=*EZdDo~_naXREh0 z*cxrkwia8PO}4e$I&2}^YFoq>v#qslv)yBR#P*^rTm?@MA^Mrb#L1+>d z3X6m`Au4PZt`n{oZWL}7ZV_%1?hv|#Ug5XG0pVfcQQ@HQgz%(rNO(s0z3`&&n((FF zWFKuWwAb1t`+EC9`_uM6+K<|g+uyT)VE@SeiTx}4*Y{-@HqmGwT>>w z2FE7Hg^taRiyYTDZgT8!-0Ha9vD2~3vBz<@<6g%xQ6o+kOT<}Xt++^BF1Ct(afR3+ zhQ!rkM2v|Sh*Z2-+%DcC-X`85c8j~kz2ZIMK5@VJh z5kC|EC4QHJDW(*MbF=dz=atS|oITDx&I8V;ozFU-b3X6J=cO7yabG_<%$MuQpbJrKHuUw~GKc+&e VBh{5UvcHCr{?Ch&N*JV${x4>v-=+Wn literal 0 HcmV?d00001 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 + + + + +