diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.pbxproj b/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.pbxproj index 78be48a..65569fb 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.pbxproj +++ b/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.pbxproj @@ -209,10 +209,11 @@ TargetAttributes = { 4F60711A1B6366ED0058F570 = { CreatedOnToolsVersion = 6.4; - LastSwiftMigration = 0800; + LastSwiftMigration = 0940; }; 4FBAA6FC1B4D807F00C8657F = { CreatedOnToolsVersion = 6.4; + LastSwiftMigration = 0940; }; }; }; @@ -325,7 +326,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -348,7 +350,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -453,7 +456,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -467,7 +471,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/Main.storyboard b/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/Main.storyboard index 280b163..19e6046 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/Main.storyboard +++ b/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/Main.storyboard @@ -1,8 +1,12 @@ - - + + + + + - + + @@ -14,42 +18,39 @@ - + - - + diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/ViewController.swift b/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/ViewController.swift index 70c3acd..a525b57 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/ViewController.swift +++ b/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/ViewController.swift @@ -61,7 +61,7 @@ class ViewController: UIViewController { // Dispose of any resources that can be recreated. } - func tappedButton(sender: DOFavoriteButton) { + @objc func tappedButton(sender: DOFavoriteButton) { if sender.isSelected { sender.deselect() } else { diff --git a/DOFavoriteButton/DOFavoriteButton.swift b/DOFavoriteButton/DOFavoriteButton.swift index 47e6d9d..5c77f11 100644 --- a/DOFavoriteButton/DOFavoriteButton.swift +++ b/DOFavoriteButton/DOFavoriteButton.swift @@ -128,7 +128,7 @@ open class DOFavoriteButton: UIButton { circleShape.mask = circleMask let maskPath = UIBezierPath(rect: imageFrame) - maskPath.addArc(withCenter: imgCenterPoint, radius: 0.1, startAngle: CGFloat(0.0), endAngle: CGFloat(M_PI * 2), clockwise: true) + maskPath.addArc(withCenter: imgCenterPoint, radius: 0.1, startAngle: CGFloat(0.0), endAngle: CGFloat(Double.pi * 2), clockwise: true) circleMask.path = maskPath.cgPath //=============== @@ -155,7 +155,7 @@ open class DOFavoriteButton: UIButton { line.strokeStart = 0.0 line.strokeEnd = 0.0 line.opacity = 0.0 - line.transform = CATransform3DMakeRotation(CGFloat(M_PI) / 5 * (CGFloat(i) * 2 + 1), 0.0, 0.0, 1.0) + line.transform = CATransform3DMakeRotation(CGFloat(Double.pi) / 5 * (CGFloat(i) * 2 + 1), 0.0, 0.0, 1.0) self.layer.addSublayer(line) lines.append(line) } @@ -345,19 +345,19 @@ open class DOFavoriteButton: UIButton { self.addTarget(self, action: #selector(DOFavoriteButton.touchCancel(_:)), for: UIControlEvents.touchCancel) } - func touchDown(_ sender: DOFavoriteButton) { + @objc func touchDown(_ sender: DOFavoriteButton) { self.layer.opacity = 0.4 } - func touchUpInside(_ sender: DOFavoriteButton) { + @objc func touchUpInside(_ sender: DOFavoriteButton) { self.layer.opacity = 1.0 } - func touchDragExit(_ sender: DOFavoriteButton) { + @objc func touchDragExit(_ sender: DOFavoriteButton) { self.layer.opacity = 1.0 } - func touchDragEnter(_ sender: DOFavoriteButton) { + @objc func touchDragEnter(_ sender: DOFavoriteButton) { self.layer.opacity = 0.4 } - func touchCancel(_ sender: DOFavoriteButton) { + @objc func touchCancel(_ sender: DOFavoriteButton) { self.layer.opacity = 1.0 }