From 8a7ff148c5408860334e5c35da20e9db140d686d Mon Sep 17 00:00:00 2001 From: ykyouhei Date: Sun, 18 Sep 2016 16:54:59 +0900 Subject: [PATCH 1/3] swift3 --- KYShutterButton.podspec | 2 +- KYShutterButton.xcodeproj/project.pbxproj | 12 +- .../xcschemes/KYShutterButton.xcscheme | 2 +- KYShutterButton/Classes/KYShutterButton.swift | 144 +++++++++--------- KYShutterButton/Info.plist | 2 +- README.md | 3 +- 6 files changed, 88 insertions(+), 77 deletions(-) diff --git a/KYShutterButton.podspec b/KYShutterButton.podspec index 77276c9..0f15b91 100644 --- a/KYShutterButton.podspec +++ b/KYShutterButton.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "KYShutterButton" - s.version = "1.0.4" + s.version = "2.0.0" s.summary = "KYShutterButton is a custom button that is similar to the shutter button of the camera app" s.homepage = "https://github.com/ykyouhei/KYShutterButton" s.license = "MIT" diff --git a/KYShutterButton.xcodeproj/project.pbxproj b/KYShutterButton.xcodeproj/project.pbxproj index 328a03a..eb1f224 100644 --- a/KYShutterButton.xcodeproj/project.pbxproj +++ b/KYShutterButton.xcodeproj/project.pbxproj @@ -101,11 +101,12 @@ 410B23391C47E2E30078A5A0 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = kyo__hei; TargetAttributes = { 410B23411C47E2E30078A5A0 = { CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0800; }; }; }; @@ -161,8 +162,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -209,8 +212,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -230,6 +235,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -241,6 +247,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -252,6 +259,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -259,6 +267,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -269,6 +278,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.kyo--hei.KYShutterButton"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/KYShutterButton.xcodeproj/xcshareddata/xcschemes/KYShutterButton.xcscheme b/KYShutterButton.xcodeproj/xcshareddata/xcschemes/KYShutterButton.xcscheme index e15e60f..3ff4ba7 100644 --- a/KYShutterButton.xcodeproj/xcshareddata/xcschemes/KYShutterButton.xcscheme +++ b/KYShutterButton.xcodeproj/xcshareddata/xcschemes/KYShutterButton.xcscheme @@ -1,6 +1,6 @@ UIBezierPath { + private func p_arcPathWithProgress(_ progress: CGFloat, clockwise: Bool = true) -> UIBezierPath { let diameter = 2*CGFloat(M_PI)*(self.bounds.width/2 - self._arcWidth/3) let startAngle = clockwise ? -CGFloat(M_PI_2) : @@ -353,7 +353,7 @@ public class KYShutterButton: UIButton { CGFloat(M_PI*2.0)*progress - CGFloat(M_PI_2) : CGFloat(M_PI*2.0)*progress - CGFloat(M_PI_2) + CGFloat(M_PI)*(540/diameter)/180 let path = UIBezierPath( - arcCenter: CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)), + arcCenter: CGPoint(x: self.bounds.midX, y: self.bounds.midY), radius: self.bounds.width/2 - self._arcWidth/3, startAngle: startAngle, endAngle: endAngle, diff --git a/KYShutterButton/Info.plist b/KYShutterButton/Info.plist index d3de8ee..7e7479f 100644 --- a/KYShutterButton/Info.plist +++ b/KYShutterButton/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0 + 2.0.0 CFBundleSignature ???? CFBundleVersion diff --git a/README.md b/README.md index 595e515..dfdbc35 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ [![Pod Version](http://img.shields.io/cocoapods/v/KYShutterButton.svg?style=flat)](http://cocoadocs.org/docsets/KYShutterButton/) [![Pod Platform](http://img.shields.io/cocoapods/p/KYShutterButton.svg?style=flat)](http://cocoadocs.org/docsets/KYShutterButton/) [![Pod License](http://img.shields.io/cocoapods/l/KYShutterButton.svg?style=flat)](https://github.com/ykyohei/KYShutterButton/blob/master/LICENSE) -[![Language](http://img.shields.io/badge/language-swift-brightgreen.svg?style=flat)](https://developer.apple.com/swift) +![Swift version](https://img.shields.io/badge/swift-3.0-orange.svg) + `KYShutterButton` is a custom button that is similar to the shutter button of the camera app From f4fca25fac5125cd6eecde9e1c237199e94e1b40 Mon Sep 17 00:00:00 2001 From: ykyouhei Date: Sun, 18 Sep 2016 16:55:40 +0900 Subject: [PATCH 2/3] add swift-version. --- .swift-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .swift-version diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..9f55b2c --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +3.0 From fc852c762747598b01df2b4d2d28c6ff3c0f47c4 Mon Sep 17 00:00:00 2001 From: ykyouhei Date: Sun, 18 Sep 2016 17:19:48 +0900 Subject: [PATCH 3/3] fix Example. --- Example/AppDelegate.swift | 46 ++ .../AppIcon.appiconset/Contents.json | 0 Example/Base.lproj/LaunchScreen.storyboard | 27 ++ .../{Example => }/Base.lproj/Main.storyboard | 131 +++--- Example/Example.xcodeproj/project.pbxproj | 445 ------------------ .../contents.xcworkspacedata | 7 - Example/Example/AppDelegate.swift | 62 --- Example/Example/Base.lproj/LaunchScreen.xib | 41 -- Example/Example/ViewController.swift | 51 -- Example/ExampleTests/ExampleTests.swift | 36 -- Example/ExampleTests/Info.plist | 24 - Example/{Example => }/Info.plist | 2 - Example/ViewController.swift | 33 ++ KYShutterButton.xcodeproj/project.pbxproj | 183 +++++++ KYShutterButton/Classes/KYShutterButton.swift | 33 +- 15 files changed, 372 insertions(+), 749 deletions(-) create mode 100644 Example/AppDelegate.swift rename Example/{Example/Images.xcassets => Assets.xcassets}/AppIcon.appiconset/Contents.json (100%) create mode 100644 Example/Base.lproj/LaunchScreen.storyboard rename Example/{Example => }/Base.lproj/Main.storyboard (60%) delete mode 100644 Example/Example.xcodeproj/project.pbxproj delete mode 100644 Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 Example/Example/AppDelegate.swift delete mode 100644 Example/Example/Base.lproj/LaunchScreen.xib delete mode 100644 Example/Example/ViewController.swift delete mode 100644 Example/ExampleTests/ExampleTests.swift delete mode 100644 Example/ExampleTests/Info.plist rename Example/{Example => }/Info.plist (95%) create mode 100644 Example/ViewController.swift diff --git a/Example/AppDelegate.swift b/Example/AppDelegate.swift new file mode 100644 index 0000000..04063c6 --- /dev/null +++ b/Example/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// Example +// +// Created by kyo__hei on 2016/09/18. +// Copyright © 2016年 kyo__hei. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json rename to Example/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Example/Base.lproj/LaunchScreen.storyboard b/Example/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ b/Example/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Example/Base.lproj/Main.storyboard b/Example/Base.lproj/Main.storyboard similarity index 60% rename from Example/Example/Base.lproj/Main.storyboard rename to Example/Base.lproj/Main.storyboard index 403d3e8..de34bc9 100644 --- a/Example/Example/Base.lproj/Main.storyboard +++ b/Example/Base.lproj/Main.storyboard @@ -1,153 +1,146 @@ - + - + + - + - + - - + + - - + + - - - + + - - + + - + - + - - - + + - - + + - + - + - - - + + - - + + - + - + - - - + + - - + + - + - - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj deleted file mode 100644 index 9b2c965..0000000 --- a/Example/Example.xcodeproj/project.pbxproj +++ /dev/null @@ -1,445 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 410B23511C47E43B0078A5A0 /* KYShutterButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 410B23501C47E43B0078A5A0 /* KYShutterButton.swift */; }; - 419E22DE1B2D85CF00DA0E57 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419E22DD1B2D85CF00DA0E57 /* AppDelegate.swift */; }; - 419E22E01B2D85CF00DA0E57 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419E22DF1B2D85CF00DA0E57 /* ViewController.swift */; }; - 419E22E31B2D85CF00DA0E57 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 419E22E11B2D85CF00DA0E57 /* Main.storyboard */; }; - 419E22E51B2D85CF00DA0E57 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 419E22E41B2D85CF00DA0E57 /* Images.xcassets */; }; - 419E22E81B2D85CF00DA0E57 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419E22E61B2D85CF00DA0E57 /* LaunchScreen.xib */; }; - 419E22F41B2D85CF00DA0E57 /* ExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419E22F31B2D85CF00DA0E57 /* ExampleTests.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 419E22EE1B2D85CF00DA0E57 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 419E22D01B2D85CF00DA0E57 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 419E22D71B2D85CF00DA0E57; - remoteInfo = Example; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 410B23501C47E43B0078A5A0 /* KYShutterButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = KYShutterButton.swift; path = ../KYShutterButton/Classes/KYShutterButton.swift; sourceTree = ""; }; - 419E22D81B2D85CF00DA0E57 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 419E22DC1B2D85CF00DA0E57 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 419E22DD1B2D85CF00DA0E57 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 419E22DF1B2D85CF00DA0E57 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 419E22E21B2D85CF00DA0E57 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 419E22E41B2D85CF00DA0E57 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 419E22E71B2D85CF00DA0E57 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 419E22ED1B2D85CF00DA0E57 /* ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 419E22F21B2D85CF00DA0E57 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 419E22F31B2D85CF00DA0E57 /* ExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleTests.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 419E22D51B2D85CF00DA0E57 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 419E22EA1B2D85CF00DA0E57 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 419E22CF1B2D85CF00DA0E57 = { - isa = PBXGroup; - children = ( - 419E22DA1B2D85CF00DA0E57 /* Example */, - 419E22F01B2D85CF00DA0E57 /* ExampleTests */, - 419E22D91B2D85CF00DA0E57 /* Products */, - ); - sourceTree = ""; - }; - 419E22D91B2D85CF00DA0E57 /* Products */ = { - isa = PBXGroup; - children = ( - 419E22D81B2D85CF00DA0E57 /* Example.app */, - 419E22ED1B2D85CF00DA0E57 /* ExampleTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 419E22DA1B2D85CF00DA0E57 /* Example */ = { - isa = PBXGroup; - children = ( - 419E22FD1B2D85D800DA0E57 /* KYShutterButton */, - 419E22DD1B2D85CF00DA0E57 /* AppDelegate.swift */, - 419E22DF1B2D85CF00DA0E57 /* ViewController.swift */, - 419E22E11B2D85CF00DA0E57 /* Main.storyboard */, - 419E22E41B2D85CF00DA0E57 /* Images.xcassets */, - 419E22E61B2D85CF00DA0E57 /* LaunchScreen.xib */, - 419E22DB1B2D85CF00DA0E57 /* Supporting Files */, - ); - path = Example; - sourceTree = ""; - }; - 419E22DB1B2D85CF00DA0E57 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 419E22DC1B2D85CF00DA0E57 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 419E22F01B2D85CF00DA0E57 /* ExampleTests */ = { - isa = PBXGroup; - children = ( - 419E22F31B2D85CF00DA0E57 /* ExampleTests.swift */, - 419E22F11B2D85CF00DA0E57 /* Supporting Files */, - ); - path = ExampleTests; - sourceTree = ""; - }; - 419E22F11B2D85CF00DA0E57 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 419E22F21B2D85CF00DA0E57 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 419E22FD1B2D85D800DA0E57 /* KYShutterButton */ = { - isa = PBXGroup; - children = ( - 410B23501C47E43B0078A5A0 /* KYShutterButton.swift */, - ); - name = KYShutterButton; - path = ../../Classes; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 419E22D71B2D85CF00DA0E57 /* Example */ = { - isa = PBXNativeTarget; - buildConfigurationList = 419E22F71B2D85CF00DA0E57 /* Build configuration list for PBXNativeTarget "Example" */; - buildPhases = ( - 419E22D41B2D85CF00DA0E57 /* Sources */, - 419E22D51B2D85CF00DA0E57 /* Frameworks */, - 419E22D61B2D85CF00DA0E57 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Example; - productName = Example; - productReference = 419E22D81B2D85CF00DA0E57 /* Example.app */; - productType = "com.apple.product-type.application"; - }; - 419E22EC1B2D85CF00DA0E57 /* ExampleTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 419E22FA1B2D85CF00DA0E57 /* Build configuration list for PBXNativeTarget "ExampleTests" */; - buildPhases = ( - 419E22E91B2D85CF00DA0E57 /* Sources */, - 419E22EA1B2D85CF00DA0E57 /* Frameworks */, - 419E22EB1B2D85CF00DA0E57 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 419E22EF1B2D85CF00DA0E57 /* PBXTargetDependency */, - ); - name = ExampleTests; - productName = ExampleTests; - productReference = 419E22ED1B2D85CF00DA0E57 /* ExampleTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 419E22D01B2D85CF00DA0E57 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0730; - ORGANIZATIONNAME = "Kyouhei Yamaguchi"; - TargetAttributes = { - 419E22D71B2D85CF00DA0E57 = { - CreatedOnToolsVersion = 6.3.1; - }; - 419E22EC1B2D85CF00DA0E57 = { - CreatedOnToolsVersion = 6.3.1; - TestTargetID = 419E22D71B2D85CF00DA0E57; - }; - }; - }; - buildConfigurationList = 419E22D31B2D85CF00DA0E57 /* Build configuration list for PBXProject "Example" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 419E22CF1B2D85CF00DA0E57; - productRefGroup = 419E22D91B2D85CF00DA0E57 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 419E22D71B2D85CF00DA0E57 /* Example */, - 419E22EC1B2D85CF00DA0E57 /* ExampleTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 419E22D61B2D85CF00DA0E57 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 419E22E31B2D85CF00DA0E57 /* Main.storyboard in Resources */, - 419E22E81B2D85CF00DA0E57 /* LaunchScreen.xib in Resources */, - 419E22E51B2D85CF00DA0E57 /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 419E22EB1B2D85CF00DA0E57 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 419E22D41B2D85CF00DA0E57 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 410B23511C47E43B0078A5A0 /* KYShutterButton.swift in Sources */, - 419E22E01B2D85CF00DA0E57 /* ViewController.swift in Sources */, - 419E22DE1B2D85CF00DA0E57 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 419E22E91B2D85CF00DA0E57 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 419E22F41B2D85CF00DA0E57 /* ExampleTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 419E22EF1B2D85CF00DA0E57 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 419E22D71B2D85CF00DA0E57 /* Example */; - targetProxy = 419E22EE1B2D85CF00DA0E57 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 419E22E11B2D85CF00DA0E57 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 419E22E21B2D85CF00DA0E57 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 419E22E61B2D85CF00DA0E57 /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 419E22E71B2D85CF00DA0E57 /* Base */, - ); - name = LaunchScreen.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 419E22F51B2D85CF00DA0E57 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 419E22F61B2D85CF00DA0E57 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 419E22F81B2D85CF00DA0E57 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = Example/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.ykyouhei.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 419E22F91B2D85CF00DA0E57 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = Example/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.ykyouhei.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 419E22FB1B2D85CF00DA0E57 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = ExampleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.ykyouhei.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; - }; - name = Debug; - }; - 419E22FC1B2D85CF00DA0E57 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = ExampleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.ykyouhei.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 419E22D31B2D85CF00DA0E57 /* Build configuration list for PBXProject "Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 419E22F51B2D85CF00DA0E57 /* Debug */, - 419E22F61B2D85CF00DA0E57 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 419E22F71B2D85CF00DA0E57 /* Build configuration list for PBXNativeTarget "Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 419E22F81B2D85CF00DA0E57 /* Debug */, - 419E22F91B2D85CF00DA0E57 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 419E22FA1B2D85CF00DA0E57 /* Build configuration list for PBXNativeTarget "ExampleTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 419E22FB1B2D85CF00DA0E57 /* Debug */, - 419E22FC1B2D85CF00DA0E57 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 419E22D01B2D85CF00DA0E57 /* Project object */; -} diff --git a/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 6d2a51b..0000000 --- a/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift deleted file mode 100644 index f15e34f..0000000 --- a/Example/Example/AppDelegate.swift +++ /dev/null @@ -1,62 +0,0 @@ -/* -The MIT License (MIT) - -Copyright (c) 2015 Kyohei Yamaguchi - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - // Override point for customization after application launch. - return true - } - - func applicationWillResignActive(application: UIApplication) { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. - } - - func applicationDidEnterBackground(application: UIApplication) { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - } - - func applicationWillEnterForeground(application: UIApplication) { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. - } - - func applicationDidBecomeActive(application: UIApplication) { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - } - - func applicationWillTerminate(application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - } - - -} - diff --git a/Example/Example/Base.lproj/LaunchScreen.xib b/Example/Example/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 2aeae02..0000000 --- a/Example/Example/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift deleted file mode 100644 index 31bbb29..0000000 --- a/Example/Example/ViewController.swift +++ /dev/null @@ -1,51 +0,0 @@ -/* -The MIT License (MIT) - -Copyright (c) 2015 Kyohei Yamaguchi - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -import UIKit - -class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view, typically from a nib. - } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } - - @IBAction func didTapButton(sender: KYShutterButton) { - switch sender.buttonState { - case .Normal: - sender.buttonState = .Recording - case .Recording: - sender.buttonState = .Normal - } - } - - - -} - diff --git a/Example/ExampleTests/ExampleTests.swift b/Example/ExampleTests/ExampleTests.swift deleted file mode 100644 index fce341d..0000000 --- a/Example/ExampleTests/ExampleTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// ExampleTests.swift -// ExampleTests -// -// Created by kyo__hei on 2015/06/14. -// Copyright (c) 2015年 Kyouhei Yamaguchi. All rights reserved. -// - -import UIKit -import XCTest - -class ExampleTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - XCTAssert(true, "Pass") - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measureBlock() { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/Example/ExampleTests/Info.plist b/Example/ExampleTests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/Example/ExampleTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Example/Example/Info.plist b/Example/Info.plist similarity index 95% rename from Example/Example/Info.plist rename to Example/Info.plist index 6905cc6..38e98af 100644 --- a/Example/Example/Info.plist +++ b/Example/Info.plist @@ -16,8 +16,6 @@ APPL CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/Example/ViewController.swift b/Example/ViewController.swift new file mode 100644 index 0000000..0d6faf1 --- /dev/null +++ b/Example/ViewController.swift @@ -0,0 +1,33 @@ +// +// ViewController.swift +// Example +// +// Created by kyo__hei on 2016/09/18. +// Copyright © 2016年 kyo__hei. All rights reserved. +// + +import UIKit +import KYShutterButton + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + @IBAction func didTapButton(_ sender: KYShutterButton) { + switch sender.buttonState { + case .normal: + sender.buttonState = .recording + case .recording: + sender.buttonState = .normal + } + } + +} diff --git a/KYShutterButton.xcodeproj/project.pbxproj b/KYShutterButton.xcodeproj/project.pbxproj index eb1f224..7a5a054 100644 --- a/KYShutterButton.xcodeproj/project.pbxproj +++ b/KYShutterButton.xcodeproj/project.pbxproj @@ -9,13 +9,51 @@ /* Begin PBXBuildFile section */ 410B23461C47E2E30078A5A0 /* KYShutterButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B23451C47E2E30078A5A0 /* KYShutterButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 410B234F1C47E3D00078A5A0 /* KYShutterButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 410B234E1C47E3D00078A5A0 /* KYShutterButton.swift */; }; + 4159763A1D8E805F0007ACF7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 415976391D8E805F0007ACF7 /* AppDelegate.swift */; }; + 4159763C1D8E805F0007ACF7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4159763B1D8E805F0007ACF7 /* ViewController.swift */; }; + 4159763F1D8E805F0007ACF7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4159763D1D8E805F0007ACF7 /* Main.storyboard */; }; + 415976411D8E805F0007ACF7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 415976401D8E805F0007ACF7 /* Assets.xcassets */; }; + 415976441D8E805F0007ACF7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 415976421D8E805F0007ACF7 /* LaunchScreen.storyboard */; }; + 41AF6C201D8E811100A45CFE /* KYShutterButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 410B23421C47E2E30078A5A0 /* KYShutterButton.framework */; }; + 41AF6C211D8E811100A45CFE /* KYShutterButton.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 410B23421C47E2E30078A5A0 /* KYShutterButton.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 41AF6C221D8E811100A45CFE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 410B23391C47E2E30078A5A0 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 410B23411C47E2E30078A5A0; + remoteInfo = KYShutterButton; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 41AF6C241D8E811100A45CFE /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 41AF6C211D8E811100A45CFE /* KYShutterButton.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 410B23421C47E2E30078A5A0 /* KYShutterButton.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KYShutterButton.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 410B23451C47E2E30078A5A0 /* KYShutterButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KYShutterButton.h; sourceTree = ""; }; 410B23471C47E2E30078A5A0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 410B234E1C47E3D00078A5A0 /* KYShutterButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KYShutterButton.swift; sourceTree = ""; }; + 415976371D8E805E0007ACF7 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 415976391D8E805F0007ACF7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 4159763B1D8E805F0007ACF7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 4159763E1D8E805F0007ACF7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 415976401D8E805F0007ACF7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 415976431D8E805F0007ACF7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 415976451D8E805F0007ACF7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -26,6 +64,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 415976341D8E805E0007ACF7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 41AF6C201D8E811100A45CFE /* KYShutterButton.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -33,6 +79,7 @@ isa = PBXGroup; children = ( 410B23441C47E2E30078A5A0 /* KYShutterButton */, + 415976381D8E805F0007ACF7 /* Example */, 410B23431C47E2E30078A5A0 /* Products */, ); sourceTree = ""; @@ -41,6 +88,7 @@ isa = PBXGroup; children = ( 410B23421C47E2E30078A5A0 /* KYShutterButton.framework */, + 415976371D8E805E0007ACF7 /* Example.app */, ); name = Products; sourceTree = ""; @@ -63,6 +111,19 @@ path = Classes; sourceTree = ""; }; + 415976381D8E805F0007ACF7 /* Example */ = { + isa = PBXGroup; + children = ( + 415976391D8E805F0007ACF7 /* AppDelegate.swift */, + 4159763B1D8E805F0007ACF7 /* ViewController.swift */, + 4159763D1D8E805F0007ACF7 /* Main.storyboard */, + 415976401D8E805F0007ACF7 /* Assets.xcassets */, + 415976421D8E805F0007ACF7 /* LaunchScreen.storyboard */, + 415976451D8E805F0007ACF7 /* Info.plist */, + ); + path = Example; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -95,12 +156,32 @@ productReference = 410B23421C47E2E30078A5A0 /* KYShutterButton.framework */; productType = "com.apple.product-type.framework"; }; + 415976361D8E805E0007ACF7 /* Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = 415976481D8E805F0007ACF7 /* Build configuration list for PBXNativeTarget "Example" */; + buildPhases = ( + 415976331D8E805E0007ACF7 /* Sources */, + 415976341D8E805E0007ACF7 /* Frameworks */, + 415976351D8E805E0007ACF7 /* Resources */, + 41AF6C241D8E811100A45CFE /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 41AF6C231D8E811100A45CFE /* PBXTargetDependency */, + ); + name = Example; + productName = Example; + productReference = 415976371D8E805E0007ACF7 /* Example.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 410B23391C47E2E30078A5A0 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftUpdateCheck = 0800; LastUpgradeCheck = 0800; ORGANIZATIONNAME = kyo__hei; TargetAttributes = { @@ -108,6 +189,10 @@ CreatedOnToolsVersion = 7.2; LastSwiftMigration = 0800; }; + 415976361D8E805E0007ACF7 = { + CreatedOnToolsVersion = 8.0; + ProvisioningStyle = Manual; + }; }; }; buildConfigurationList = 410B233C1C47E2E30078A5A0 /* Build configuration list for PBXProject "KYShutterButton" */; @@ -116,6 +201,7 @@ hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 410B23381C47E2E30078A5A0; productRefGroup = 410B23431C47E2E30078A5A0 /* Products */; @@ -123,6 +209,7 @@ projectRoot = ""; targets = ( 410B23411C47E2E30078A5A0 /* KYShutterButton */, + 415976361D8E805E0007ACF7 /* Example */, ); }; /* End PBXProject section */ @@ -135,6 +222,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 415976351D8E805E0007ACF7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 415976441D8E805F0007ACF7 /* LaunchScreen.storyboard in Resources */, + 415976411D8E805F0007ACF7 /* Assets.xcassets in Resources */, + 4159763F1D8E805F0007ACF7 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -146,8 +243,44 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 415976331D8E805E0007ACF7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4159763C1D8E805F0007ACF7 /* ViewController.swift in Sources */, + 4159763A1D8E805F0007ACF7 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 41AF6C231D8E811100A45CFE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 410B23411C47E2E30078A5A0 /* KYShutterButton */; + targetProxy = 41AF6C221D8E811100A45CFE /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 4159763D1D8E805F0007ACF7 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 4159763E1D8E805F0007ACF7 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 415976421D8E805F0007ACF7 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 415976431D8E805F0007ACF7 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 410B23481C47E2E30078A5A0 /* Debug */ = { isa = XCBuildConfiguration; @@ -249,6 +382,7 @@ CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -269,6 +403,7 @@ CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -282,6 +417,45 @@ }; name = Release; }; + 415976461D8E805F0007ACF7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = Example/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.kyo--hei.Example"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 3.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + 415976471D8E805F0007ACF7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = Example/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.kyo--hei.Example"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -303,6 +477,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 415976481D8E805F0007ACF7 /* Build configuration list for PBXNativeTarget "Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 415976461D8E805F0007ACF7 /* Debug */, + 415976471D8E805F0007ACF7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 410B23391C47E2E30078A5A0 /* Project object */; diff --git a/KYShutterButton/Classes/KYShutterButton.swift b/KYShutterButton/Classes/KYShutterButton.swift index 482d3db..9953ad6 100644 --- a/KYShutterButton/Classes/KYShutterButton.swift +++ b/KYShutterButton/Classes/KYShutterButton.swift @@ -114,18 +114,7 @@ open class KYShutterButton: UIButton { @objc public var shutterType: ShutterType = .normal { didSet { - switch shutterType { - case .normal: - _arcLayer.lineDashPattern = nil - _progressLayer.isHidden = true - case .slowMotion: - _arcLayer.lineDashPattern = [1, 1] - _progressLayer.isHidden = true - case .timeLapse: - let diameter = 2*CGFloat(M_PI)*(self.bounds.width/2 - self._arcWidth/2) - _arcLayer.lineDashPattern = [1, NSNumber(floatLiteral: (diameter/10 - 1).native)] - _progressLayer.isHidden = false - } + updateLayers() } } @@ -320,6 +309,8 @@ open class KYShutterButton: UIButton { p_removeTimeLapseAnimations() p_addTimeLapseAnimations() } + + updateLayers() } @objc @@ -362,4 +353,22 @@ open class KYShutterButton: UIButton { return path } + private func updateLayers() { + switch shutterType { + case .normal: + _arcLayer.lineDashPattern = nil + _progressLayer.isHidden = true + case .slowMotion: + _arcLayer.lineDashPattern = [1, 1] + _progressLayer.isHidden = true + case .timeLapse: + let diameter = CGFloat(M_PI)*(self.bounds.width/2 - self._arcWidth/2) + let progressDiameter = 2*CGFloat(M_PI)*(self.bounds.width/2 - self._arcWidth/3) + + _arcLayer.lineDashPattern = [1, NSNumber(floatLiteral: (diameter/10 - 1).native)] + _progressLayer.lineDashPattern = [1, NSNumber(floatLiteral: (progressDiameter/60 - 1).native)] + _progressLayer.isHidden = false + } + } + }