├── ProcessButton.gif ├── ProcessButton.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── ProcessButton.podspec ├── ProcessButton ├── Util │ └── Util.swift ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── ViewController.swift ├── ProcessButton │ ├── ProcessButton.swift │ ├── ProcessButtonUtil.swift │ ├── FlatButton.swift │ └── ProcessView.swift ├── Info.plist ├── AppDelegate.swift └── Base.lproj │ └── Main.storyboard ├── ProcessButtonTests ├── Info.plist └── ProcessButtonTests.swift ├── LICENSE ├── README.md └── .gitignore /ProcessButton.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Viddi/ios-process-button/HEAD/ProcessButton.gif -------------------------------------------------------------------------------- /ProcessButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ProcessButton.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = 'ProcessButton' 3 | spec.version = '0.2.0' 4 | spec.license = 'MIT' 5 | spec.homepage = 'https://github.com/Viddi/ios-process-button' 6 | spec.authors = { 'Vidar Ottosson' => 'viddi@nplexity.com' } 7 | spec.summary = 'Button that animates while an action is being processed' 8 | spec.source = { :git => 'https://github.com/Viddi/ios-process-button.git', :tag => 'v0.2.0' } 9 | spec.source_files = 'ProcessButton/ProcessButton/*' 10 | spec.platform = :ios, '8.0' 11 | spec.requires_arc = true 12 | end 13 | -------------------------------------------------------------------------------- /ProcessButton/Util/Util.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Util.swift 3 | // ProcessButton 4 | // 5 | // Created by Vidar Ottosson on 2/7/15. 6 | // Copyright (c) 2015 Vidar Ottosson. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class Util { 12 | /** 13 | Randomizes the time it takes for the mocked request to process (2 - 6) seconds 14 | 15 | :returns: seconds 16 | */ 17 | class func randomProcessTime() -> Double { 18 | return Double(arc4random_uniform(4)) + 2 19 | } 20 | 21 | /** 22 | A mocked response. Returns true if the request was successful, or false for error 23 | 24 | :returns: A Bool for if the response was successful or not 25 | */ 26 | class func randomResponse() -> Bool { 27 | return Int(arc4random_uniform(2)) == 1 ? true : false 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ProcessButton/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ProcessButtonTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | is.viddi.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ProcessButtonTests/ProcessButtonTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProcessButtonTests.swift 3 | // ProcessButtonTests 4 | // 5 | // Created by Vidar Ottosson on 2/7/15. 6 | // Copyright (c) 2015 Vidar Ottosson. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class ProcessButtonTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Viðar Ingi Ottósson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /ProcessButton/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // ProcessButton 4 | // 5 | // Created by Vidar Ottosson on 2/7/15. 6 | // Copyright (c) 2015 Vidar Ottosson. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | enum Colors { 14 | static let PurpleDefault = UIColor(red: 171 / 255.0, green: 91 / 255.0, blue: 190 / 255.0, alpha: 1.0) 15 | static let PurplePressed = UIColor(red: 153 / 255.0, green: 81 / 255.0, blue: 170 / 255.0, alpha: 1.0) 16 | } 17 | 18 | @IBOutlet weak var btnSignIn: ProcessButton! 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | 23 | btnSignIn.setBackgroundColor(Colors.PurpleDefault, highlightedState: Colors.PurplePressed) 24 | } 25 | 26 | @IBAction func signIn(sender: AnyObject) { 27 | btnSignIn.animate(true) 28 | 29 | let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(Util.randomProcessTime() * Double(NSEC_PER_SEC))) 30 | dispatch_after(delayTime, dispatch_get_main_queue()) { 31 | if Util.randomResponse() { 32 | self.btnSignIn.showSuccessText("Success", seconds: ProcessButtonUtil.Length.Short) 33 | } else { 34 | self.btnSignIn.showErrorText("Error", seconds: ProcessButtonUtil.Length.Long) 35 | } 36 | } 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /ProcessButton/ProcessButton/ProcessButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProcessButton.swift 3 | // ProcessButton 4 | // 5 | // Created by Vidar Ottosson on 2/7/15. 6 | // Copyright (c) 2015 Vidar Ottosson. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ProcessButton: FlatButton, FlatButtonDelegate { 12 | 13 | let LineHeight: CGFloat = 4.0 14 | 15 | var processView: ProcessView! 16 | 17 | override init(frame: CGRect) { 18 | super.init(frame: frame) 19 | prepareView() 20 | } 21 | 22 | required init(coder aDecoder: NSCoder) { 23 | super.init(coder: aDecoder) 24 | prepareView() 25 | } 26 | 27 | override func layoutSubviews() { 28 | super.layoutSubviews() 29 | processView.frame = CGRect(x: 0, y: frame.height - LineHeight, width: frame.width, height: LineHeight) 30 | } 31 | 32 | private func prepareView() { 33 | delegate = self 34 | processView = ProcessView(frame: CGRect(x: 0, y: frame.height - LineHeight, width: frame.width, height: LineHeight)) 35 | addSubview(processView) 36 | } 37 | 38 | func animate(shouldAnimate: Bool) { 39 | if shouldAnimate { 40 | enabled = false 41 | } else { 42 | enabled = true 43 | } 44 | processView.animate(shouldAnimate) 45 | } 46 | 47 | func showSuccess() { 48 | animate(false) 49 | } 50 | 51 | func showError() { 52 | animate(false) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ProcessButton/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | is.viddi.processbutton.example 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | Main 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIViewControllerBasedStatusBarAppearance 34 | 35 | UIStatusBarStyle 36 | UIStatusBarStyleLightContent 37 | UISupportedInterfaceOrientations 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationLandscapeLeft 41 | UIInterfaceOrientationLandscapeRight 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /ProcessButton/ProcessButton/ProcessButtonUtil.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProcessButtonUtil.swift 3 | // ProcessButton 4 | // 5 | // Created by Vidar Ottosson on 2/14/15. 6 | // Copyright (c) 2015 Vidar Ottosson. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ProcessButtonUtil { 12 | 13 | enum Length { 14 | static let Short: Double = 1.5 15 | static let Long: Double = 3.0 16 | } 17 | 18 | /** 19 | Creates a UIImage from a UIColor to put as a background for UIButton with a state 20 | 21 | :param: color The color to convert to UIImage 22 | 23 | :returns: UIImage with the color as its image 24 | */ 25 | internal class func imageWithColor(color: UIColor) -> UIImage { 26 | var rect: CGRect = CGRectMake(0.0, 0.0, 1.0, 1.0) 27 | UIGraphicsBeginImageContext(rect.size) 28 | var context: CGContextRef = UIGraphicsGetCurrentContext() 29 | 30 | CGContextSetFillColorWithColor(context, color.CGColor) 31 | CGContextFillRect(context, rect) 32 | 33 | var image: UIImage = UIGraphicsGetImageFromCurrentImageContext() 34 | UIGraphicsEndImageContext() 35 | 36 | return image 37 | } 38 | 39 | var colors: [UIColor]? 40 | var duration: NSTimeInterval? 41 | 42 | class var sharedInstance: ProcessButtonUtil { 43 | struct Singleton { 44 | static var instance: ProcessButtonUtil = ProcessButtonUtil() 45 | } 46 | 47 | return Singleton.instance 48 | } 49 | 50 | func setColors(colors: [UIColor]) -> ProcessButtonUtil { 51 | self.colors = colors 52 | return self 53 | } 54 | 55 | func setDuration(duration: NSTimeInterval) -> ProcessButtonUtil { 56 | self.duration = duration 57 | return self 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProcessButton 2 | 3 | iOS Buttons that animate while an action is being processed. Written in Swift. 4 | 5 | ![](ProcessButton.gif) 6 | 7 | This library was extracted from an iOS application that I was working on at the time. It's used for any sort of action that is processed asynchronously, and shows a loading-like animation until the action is done. 8 | 9 | ## Usage 10 | 11 | Basic asynchronous task animation 12 | 13 | ``` 14 | @IBOutlet weak var btnSignIn: ProcessButton! 15 | 16 | btnSignIn.animate(true) 17 | 18 | // Do some some asynchronous stuff here 19 | // and display result from callback 20 | 21 | if callbackSuccess { 22 | self.btnSignIn.showSuccessText("Success", seconds: ProcessButtonUtil.Length.Short) 23 | } else { 24 | self.btnSignIn.showErrorText("Error", seconds: ProcessButtonUtil.Length.Long) 25 | } 26 | ``` 27 | 28 | **Optional** To change the colors of the lines and the duration, put this in your AppDelegate `didFinishLaunchingWithOptions` 29 | 30 | ``` 31 | // App wide customization 32 | let colors = [UIColor.blueColor(), UIColor.redColor(), UIColor.greenColor()] 33 | let duration: NSTimeInterval = 0.3 34 | 35 | ProcessButtonUtil.sharedInstance 36 | .setColors(colors) // The colors for the animating lines. Can be any number of colors 37 | .setDuration(duration) // The time for each line to animate. Default is 0.5 38 | ``` 39 | 40 | Take a look at the project to see a full example. 41 | 42 | ## Requirements 43 | 44 | * iOS 8 or later 45 | * Xcode 6 or later 46 | 47 | ## Author 48 | Vidar Ottosson, viddi@nplexity.com 49 | 50 | ## License 51 | 52 | ProcessButton is available under the MIT license. See the [LICENSE](https://github.com/Viddi/ios-process-button/blob/master/LICENSE) file for more info. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### AppCode ### 2 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 3 | 4 | ## Directory-based project format 5 | .idea/ 6 | # if you remove the above rule, at least ignore user-specific stuff: 7 | # .idea/workspace.xml 8 | # .idea/tasks.xml 9 | # and these sensitive or high-churn files: 10 | # .idea/dataSources.ids 11 | # .idea/dataSources.xml 12 | # .idea/sqlDataSources.xml 13 | # .idea/dynamic.xml 14 | 15 | ## File-based project format 16 | *.ipr 17 | *.iml 18 | *.iws 19 | 20 | ## Additional for IntelliJ 21 | out/ 22 | 23 | # generated by mpeltonen/sbt-idea plugin 24 | .idea_modules/ 25 | 26 | # generated by JIRA plugin 27 | atlassian-ide-plugin.xml 28 | 29 | # generated by Crashlytics plugin (for Android Studio and Intellij) 30 | com_crashlytics_export_strings.xml 31 | 32 | 33 | ### Xcode ### 34 | build/ 35 | *.pbxuser 36 | !default.pbxuser 37 | *.mode1v3 38 | !default.mode1v3 39 | *.mode2v3 40 | !default.mode2v3 41 | *.perspectivev3 42 | !default.perspectivev3 43 | xcuserdata 44 | *.xccheckout 45 | *.moved-aside 46 | DerivedData 47 | *.xcuserstate 48 | 49 | 50 | ### Objective-C ### 51 | # Xcode 52 | # 53 | build/ 54 | *.pbxuser 55 | !default.pbxuser 56 | *.mode1v3 57 | !default.mode1v3 58 | *.mode2v3 59 | !default.mode2v3 60 | *.perspectivev3 61 | !default.perspectivev3 62 | xcuserdata 63 | *.xccheckout 64 | *.moved-aside 65 | DerivedData 66 | *.hmap 67 | *.ipa 68 | *.xcuserstate 69 | 70 | # CocoaPods 71 | # 72 | # We recommend against adding the Pods directory to your .gitignore. However 73 | # you should judge for yourself, the pros and cons are mentioned at: 74 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 75 | # 76 | Pods/ 77 | 78 | 79 | ### OSX ### 80 | .DS_Store 81 | .AppleDouble 82 | .LSOverride 83 | 84 | # Icon must end with two \r 85 | Icon 86 | 87 | 88 | # Thumbnails 89 | ._* 90 | 91 | # Files that might appear on external disk 92 | .Spotlight-V100 93 | .Trashes 94 | 95 | # Directories potentially created on remote AFP share 96 | .AppleDB 97 | .AppleDesktop 98 | Network Trash Folder 99 | Temporary Items 100 | .apdisk 101 | 102 | -------------------------------------------------------------------------------- /ProcessButton/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // ProcessButton 4 | // 5 | // Created by Vidar Ottosson on 2/7/15. 6 | // Copyright (c) 2015 Vidar Ottosson. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /ProcessButton/ProcessButton/FlatButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FlatButton.swift 3 | // ProcessButton 4 | // 5 | // Created by Vidar Ottosson on 2/7/15. 6 | // Copyright (c) 2015 Vidar Ottosson. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol FlatButtonDelegate { 12 | func showSuccess() 13 | func showError() 14 | } 15 | 16 | class FlatButton: UIButton { 17 | 18 | enum Colors { 19 | static let Success = UIColor(red: 153 / 255.0, green: 204 / 255.0, blue: 0 / 255.0, alpha: 1.0) 20 | static let Error = UIColor(red: 255 / 255.0, green: 68 / 255.0, blue: 68 / 255.0, alpha: 1.0) 21 | } 22 | 23 | var delegate: FlatButtonDelegate? 24 | 25 | override init(frame: CGRect) { 26 | super.init(frame: frame) 27 | prepareView() 28 | } 29 | 30 | required init(coder aDecoder: NSCoder) { 31 | super.init(coder: aDecoder) 32 | prepareView() 33 | } 34 | 35 | private func prepareView() { 36 | titleLabel?.font = UIFont.boldSystemFontOfSize(36.0) 37 | setTitleColor(UIColor.whiteColor(), forState: UIControlState.Normal) 38 | setTitleColor(UIColor.whiteColor(), forState: UIControlState.Selected) 39 | setTitleColor(UIColor.whiteColor(), forState: UIControlState.Highlighted) 40 | setTitleColor(UIColor.whiteColor(), forState: UIControlState.Disabled) 41 | } 42 | 43 | private func showSuccess(text: String, seconds: Double) { 44 | delegate?.showSuccess() 45 | enabled = false 46 | 47 | var tempBackground = backgroundColor 48 | backgroundColor = Colors.Success 49 | var tempText = titleLabel?.text 50 | setTitle(text, forState: UIControlState.Normal) 51 | 52 | let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(seconds * Double(NSEC_PER_SEC))) 53 | dispatch_after(delayTime, dispatch_get_main_queue()) { 54 | self.backgroundColor = tempBackground 55 | self.setTitle(tempText, forState: UIControlState.Normal) 56 | self.enabled = true 57 | } 58 | } 59 | 60 | private func showError(text: String, seconds: Double) { 61 | delegate?.showError() 62 | enabled = false 63 | 64 | var tempBackground = backgroundColor 65 | backgroundColor = Colors.Error 66 | var tempText = titleLabel?.text 67 | setTitle(text, forState: UIControlState.Normal) 68 | 69 | let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(seconds * Double(NSEC_PER_SEC))) 70 | dispatch_after(delayTime, dispatch_get_main_queue()) { 71 | self.backgroundColor = tempBackground 72 | self.setTitle(tempText, forState: UIControlState.Normal) 73 | self.enabled = true 74 | } 75 | } 76 | 77 | func showSuccessText(text: String, seconds: Double) { 78 | showSuccess(text, seconds: seconds) 79 | } 80 | 81 | func showSuccessText(text: String) { 82 | showSuccess(text, seconds: ProcessButtonUtil.Length.Short) 83 | } 84 | 85 | func showErrorText(text: String, seconds: Double) { 86 | showError(text, seconds: seconds) 87 | } 88 | 89 | func showErrorText(text: String) { 90 | showError(text, seconds: ProcessButtonUtil.Length.Long) 91 | } 92 | 93 | func setBackgroundColor(normalState: UIColor, highlightedState: UIColor) { 94 | backgroundColor = normalState 95 | setBackgroundImage(ProcessButtonUtil.imageWithColor(highlightedState), forState: UIControlState.Highlighted) 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /ProcessButton/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ProcessButton/ProcessButton/ProcessView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProcessView.swift 3 | // ProcessButton 4 | // 5 | // Created by Vidar Ottosson on 2/7/15. 6 | // Copyright (c) 2015 Vidar Ottosson. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ProcessView: UIView { 12 | 13 | internal enum Colors { 14 | static let LoadingBlue = UIColor(red: 0 / 255.0, green: 221 / 255.0, blue: 255 / 255.0, alpha: 1.0) 15 | static let LoadingGreen = UIColor(red: 153 / 255.0, green: 204 / 255.0, blue: 0 / 255.0, alpha: 1.0) 16 | static let LoadingOrange = UIColor(red: 255.0 / 255.0, green: 187 / 255.0, blue: 51 / 255.0, alpha: 1.0) 17 | static let LoadingRed = UIColor(red: 255 / 255.0, green: 68 / 255.0, blue: 68 / 255.0, alpha: 1.0) 18 | } 19 | 20 | private let DefaultColors = [Colors.LoadingBlue, Colors.LoadingGreen, Colors.LoadingOrange, Colors.LoadingRed] 21 | private let DefaultDuration = 0.5 22 | 23 | private var duration: NSTimeInterval! 24 | private var colors: [UIColor]! 25 | private var isAnimating: Bool = true 26 | private var views: [UIView]! 27 | private var lines: [UIView]! 28 | 29 | override init(frame: CGRect) { 30 | super.init(frame: frame) 31 | 32 | if let customColors = ProcessButtonUtil.sharedInstance.colors { 33 | colors = customColors 34 | } else { 35 | colors = DefaultColors 36 | } 37 | 38 | if let customDuration = ProcessButtonUtil.sharedInstance.duration { 39 | duration = customDuration 40 | } else { 41 | duration = DefaultDuration 42 | } 43 | } 44 | 45 | required init(coder aDecoder: NSCoder) { 46 | super.init(coder: aDecoder) 47 | } 48 | 49 | private func startAnimating() { 50 | isAnimating = true 51 | views = [] 52 | 53 | for i in 0.. Void in 60 | var count: Int = 0 61 | while self.isAnimating { 62 | if count == self.views.count { 63 | count = 0 64 | } 65 | 66 | var next = false 67 | dispatch_async(dispatch_get_main_queue(), { 68 | UIView.animateWithDuration(self.duration, delay: 0, options: nil, animations: { () -> Void in 69 | if self.isAnimating { 70 | self.addSubview(self.views[count]) 71 | self.views[count].frame.origin = CGPoint(x: self.bounds.origin.x, y: 0) 72 | self.views[count].frame.size.width = self.frame.width 73 | } 74 | }, completion: { (Bool) -> Void in 75 | if self.isAnimating { 76 | var lastIndex = count - 1 77 | if lastIndex < 0 { 78 | lastIndex = self.colors.count - 1 79 | } 80 | self.views[lastIndex].frame = self.lineRect() 81 | self.views[lastIndex].removeFromSuperview() 82 | } 83 | next = true 84 | }) 85 | }) 86 | 87 | // Let's wait until the current animation is done before moving forward 88 | while !next { 89 | } 90 | count++ 91 | } 92 | }) 93 | 94 | } 95 | 96 | private func stopAnimating() { 97 | isAnimating = false 98 | 99 | for view in views { 100 | view.removeFromSuperview() 101 | } 102 | 103 | views.removeAll(keepCapacity: false) 104 | } 105 | 106 | private func lineRect() -> CGRect { 107 | return CGRect(x: bounds.width/2, y: bounds.origin.y, width: 0, height: frame.height) 108 | } 109 | 110 | func animate(shouldAnimate: Bool) { 111 | shouldAnimate ? startAnimating() : stopAnimating() 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /ProcessButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 193632931A9008080022DCEF /* ProcessButtonUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 193632921A9008080022DCEF /* ProcessButtonUtil.swift */; }; 11 | 194E81F91A86FF06005E8AA6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194E81F81A86FF06005E8AA6 /* AppDelegate.swift */; }; 12 | 194E81FB1A86FF06005E8AA6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194E81FA1A86FF06005E8AA6 /* ViewController.swift */; }; 13 | 194E81FE1A86FF06005E8AA6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 194E81FC1A86FF06005E8AA6 /* Main.storyboard */; }; 14 | 194E82001A86FF06005E8AA6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 194E81FF1A86FF06005E8AA6 /* Images.xcassets */; }; 15 | 194E820F1A86FF06005E8AA6 /* ProcessButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194E820E1A86FF06005E8AA6 /* ProcessButtonTests.swift */; }; 16 | 194E821B1A86FF8E005E8AA6 /* Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194E821A1A86FF8E005E8AA6 /* Util.swift */; }; 17 | 194E821D1A86FFF8005E8AA6 /* FlatButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194E821C1A86FFF8005E8AA6 /* FlatButton.swift */; }; 18 | 194E821F1A870025005E8AA6 /* ProcessButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194E821E1A870025005E8AA6 /* ProcessButton.swift */; }; 19 | 194E82211A870069005E8AA6 /* ProcessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194E82201A870069005E8AA6 /* ProcessView.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 194E82091A86FF06005E8AA6 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 194E81EB1A86FF06005E8AA6 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 194E81F21A86FF06005E8AA6; 28 | remoteInfo = ProcessButton; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 193632921A9008080022DCEF /* ProcessButtonUtil.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProcessButtonUtil.swift; path = ProcessButton/ProcessButtonUtil.swift; sourceTree = ""; }; 34 | 194E81F31A86FF06005E8AA6 /* ProcessButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ProcessButton.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 194E81F71A86FF06005E8AA6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 194E81F81A86FF06005E8AA6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 194E81FA1A86FF06005E8AA6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 38 | 194E81FD1A86FF06005E8AA6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 194E81FF1A86FF06005E8AA6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 194E82081A86FF06005E8AA6 /* ProcessButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ProcessButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 194E820D1A86FF06005E8AA6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 194E820E1A86FF06005E8AA6 /* ProcessButtonTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProcessButtonTests.swift; sourceTree = ""; }; 43 | 194E821A1A86FF8E005E8AA6 /* Util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Util.swift; path = Util/Util.swift; sourceTree = ""; }; 44 | 194E821C1A86FFF8005E8AA6 /* FlatButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FlatButton.swift; path = ProcessButton/FlatButton.swift; sourceTree = ""; }; 45 | 194E821E1A870025005E8AA6 /* ProcessButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProcessButton.swift; path = ProcessButton/ProcessButton.swift; sourceTree = ""; }; 46 | 194E82201A870069005E8AA6 /* ProcessView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProcessView.swift; path = ProcessButton/ProcessView.swift; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 194E81F01A86FF06005E8AA6 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | 194E82051A86FF06005E8AA6 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXFrameworksBuildPhase section */ 65 | 66 | /* Begin PBXGroup section */ 67 | 194E81EA1A86FF06005E8AA6 = { 68 | isa = PBXGroup; 69 | children = ( 70 | 194E81F51A86FF06005E8AA6 /* ProcessButton */, 71 | 194E820B1A86FF06005E8AA6 /* ProcessButtonTests */, 72 | 194E81F41A86FF06005E8AA6 /* Products */, 73 | ); 74 | sourceTree = ""; 75 | }; 76 | 194E81F41A86FF06005E8AA6 /* Products */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 194E81F31A86FF06005E8AA6 /* ProcessButton.app */, 80 | 194E82081A86FF06005E8AA6 /* ProcessButtonTests.xctest */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | 194E81F51A86FF06005E8AA6 /* ProcessButton */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 194E82191A86FF6D005E8AA6 /* Util */, 89 | 194E82181A86FF64005E8AA6 /* ProcessButton */, 90 | 194E81F81A86FF06005E8AA6 /* AppDelegate.swift */, 91 | 194E81FA1A86FF06005E8AA6 /* ViewController.swift */, 92 | 194E81FC1A86FF06005E8AA6 /* Main.storyboard */, 93 | 194E81FF1A86FF06005E8AA6 /* Images.xcassets */, 94 | 194E81F61A86FF06005E8AA6 /* Supporting Files */, 95 | ); 96 | path = ProcessButton; 97 | sourceTree = ""; 98 | }; 99 | 194E81F61A86FF06005E8AA6 /* Supporting Files */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 194E81F71A86FF06005E8AA6 /* Info.plist */, 103 | ); 104 | name = "Supporting Files"; 105 | sourceTree = ""; 106 | }; 107 | 194E820B1A86FF06005E8AA6 /* ProcessButtonTests */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 194E820E1A86FF06005E8AA6 /* ProcessButtonTests.swift */, 111 | 194E820C1A86FF06005E8AA6 /* Supporting Files */, 112 | ); 113 | path = ProcessButtonTests; 114 | sourceTree = ""; 115 | }; 116 | 194E820C1A86FF06005E8AA6 /* Supporting Files */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 194E820D1A86FF06005E8AA6 /* Info.plist */, 120 | ); 121 | name = "Supporting Files"; 122 | sourceTree = ""; 123 | }; 124 | 194E82181A86FF64005E8AA6 /* ProcessButton */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 193632921A9008080022DCEF /* ProcessButtonUtil.swift */, 128 | 194E821C1A86FFF8005E8AA6 /* FlatButton.swift */, 129 | 194E821E1A870025005E8AA6 /* ProcessButton.swift */, 130 | 194E82201A870069005E8AA6 /* ProcessView.swift */, 131 | ); 132 | name = ProcessButton; 133 | sourceTree = ""; 134 | }; 135 | 194E82191A86FF6D005E8AA6 /* Util */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 194E821A1A86FF8E005E8AA6 /* Util.swift */, 139 | ); 140 | name = Util; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXNativeTarget section */ 146 | 194E81F21A86FF06005E8AA6 /* ProcessButton */ = { 147 | isa = PBXNativeTarget; 148 | buildConfigurationList = 194E82121A86FF06005E8AA6 /* Build configuration list for PBXNativeTarget "ProcessButton" */; 149 | buildPhases = ( 150 | 194E81EF1A86FF06005E8AA6 /* Sources */, 151 | 194E81F01A86FF06005E8AA6 /* Frameworks */, 152 | 194E81F11A86FF06005E8AA6 /* Resources */, 153 | ); 154 | buildRules = ( 155 | ); 156 | dependencies = ( 157 | ); 158 | name = ProcessButton; 159 | productName = ProcessButton; 160 | productReference = 194E81F31A86FF06005E8AA6 /* ProcessButton.app */; 161 | productType = "com.apple.product-type.application"; 162 | }; 163 | 194E82071A86FF06005E8AA6 /* ProcessButtonTests */ = { 164 | isa = PBXNativeTarget; 165 | buildConfigurationList = 194E82151A86FF06005E8AA6 /* Build configuration list for PBXNativeTarget "ProcessButtonTests" */; 166 | buildPhases = ( 167 | 194E82041A86FF06005E8AA6 /* Sources */, 168 | 194E82051A86FF06005E8AA6 /* Frameworks */, 169 | 194E82061A86FF06005E8AA6 /* Resources */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | 194E820A1A86FF06005E8AA6 /* PBXTargetDependency */, 175 | ); 176 | name = ProcessButtonTests; 177 | productName = ProcessButtonTests; 178 | productReference = 194E82081A86FF06005E8AA6 /* ProcessButtonTests.xctest */; 179 | productType = "com.apple.product-type.bundle.unit-test"; 180 | }; 181 | /* End PBXNativeTarget section */ 182 | 183 | /* Begin PBXProject section */ 184 | 194E81EB1A86FF06005E8AA6 /* Project object */ = { 185 | isa = PBXProject; 186 | attributes = { 187 | LastUpgradeCheck = 0610; 188 | ORGANIZATIONNAME = "Vidar Ottosson"; 189 | TargetAttributes = { 190 | 194E81F21A86FF06005E8AA6 = { 191 | CreatedOnToolsVersion = 6.1.1; 192 | DevelopmentTeam = 7TEH6DXDRM; 193 | }; 194 | 194E82071A86FF06005E8AA6 = { 195 | CreatedOnToolsVersion = 6.1.1; 196 | TestTargetID = 194E81F21A86FF06005E8AA6; 197 | }; 198 | }; 199 | }; 200 | buildConfigurationList = 194E81EE1A86FF06005E8AA6 /* Build configuration list for PBXProject "ProcessButton" */; 201 | compatibilityVersion = "Xcode 3.2"; 202 | developmentRegion = English; 203 | hasScannedForEncodings = 0; 204 | knownRegions = ( 205 | en, 206 | Base, 207 | ); 208 | mainGroup = 194E81EA1A86FF06005E8AA6; 209 | productRefGroup = 194E81F41A86FF06005E8AA6 /* Products */; 210 | projectDirPath = ""; 211 | projectRoot = ""; 212 | targets = ( 213 | 194E81F21A86FF06005E8AA6 /* ProcessButton */, 214 | 194E82071A86FF06005E8AA6 /* ProcessButtonTests */, 215 | ); 216 | }; 217 | /* End PBXProject section */ 218 | 219 | /* Begin PBXResourcesBuildPhase section */ 220 | 194E81F11A86FF06005E8AA6 /* Resources */ = { 221 | isa = PBXResourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | 194E81FE1A86FF06005E8AA6 /* Main.storyboard in Resources */, 225 | 194E82001A86FF06005E8AA6 /* Images.xcassets in Resources */, 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | 194E82061A86FF06005E8AA6 /* Resources */ = { 230 | isa = PBXResourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXResourcesBuildPhase section */ 237 | 238 | /* Begin PBXSourcesBuildPhase section */ 239 | 194E81EF1A86FF06005E8AA6 /* Sources */ = { 240 | isa = PBXSourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | 193632931A9008080022DCEF /* ProcessButtonUtil.swift in Sources */, 244 | 194E82211A870069005E8AA6 /* ProcessView.swift in Sources */, 245 | 194E81FB1A86FF06005E8AA6 /* ViewController.swift in Sources */, 246 | 194E821B1A86FF8E005E8AA6 /* Util.swift in Sources */, 247 | 194E821F1A870025005E8AA6 /* ProcessButton.swift in Sources */, 248 | 194E821D1A86FFF8005E8AA6 /* FlatButton.swift in Sources */, 249 | 194E81F91A86FF06005E8AA6 /* AppDelegate.swift in Sources */, 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | 194E82041A86FF06005E8AA6 /* Sources */ = { 254 | isa = PBXSourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | 194E820F1A86FF06005E8AA6 /* ProcessButtonTests.swift in Sources */, 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | }; 261 | /* End PBXSourcesBuildPhase section */ 262 | 263 | /* Begin PBXTargetDependency section */ 264 | 194E820A1A86FF06005E8AA6 /* PBXTargetDependency */ = { 265 | isa = PBXTargetDependency; 266 | target = 194E81F21A86FF06005E8AA6 /* ProcessButton */; 267 | targetProxy = 194E82091A86FF06005E8AA6 /* PBXContainerItemProxy */; 268 | }; 269 | /* End PBXTargetDependency section */ 270 | 271 | /* Begin PBXVariantGroup section */ 272 | 194E81FC1A86FF06005E8AA6 /* Main.storyboard */ = { 273 | isa = PBXVariantGroup; 274 | children = ( 275 | 194E81FD1A86FF06005E8AA6 /* Base */, 276 | ); 277 | name = Main.storyboard; 278 | sourceTree = ""; 279 | }; 280 | /* End PBXVariantGroup section */ 281 | 282 | /* Begin XCBuildConfiguration section */ 283 | 194E82101A86FF06005E8AA6 /* Debug */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ALWAYS_SEARCH_USER_PATHS = NO; 287 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 288 | CLANG_CXX_LIBRARY = "libc++"; 289 | CLANG_ENABLE_MODULES = YES; 290 | CLANG_ENABLE_OBJC_ARC = YES; 291 | CLANG_WARN_BOOL_CONVERSION = YES; 292 | CLANG_WARN_CONSTANT_CONVERSION = YES; 293 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 294 | CLANG_WARN_EMPTY_BODY = YES; 295 | CLANG_WARN_ENUM_CONVERSION = YES; 296 | CLANG_WARN_INT_CONVERSION = YES; 297 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 298 | CLANG_WARN_UNREACHABLE_CODE = YES; 299 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 300 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 301 | COPY_PHASE_STRIP = NO; 302 | ENABLE_STRICT_OBJC_MSGSEND = YES; 303 | GCC_C_LANGUAGE_STANDARD = gnu99; 304 | GCC_DYNAMIC_NO_PIC = NO; 305 | GCC_OPTIMIZATION_LEVEL = 0; 306 | GCC_PREPROCESSOR_DEFINITIONS = ( 307 | "DEBUG=1", 308 | "$(inherited)", 309 | ); 310 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 311 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 312 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 313 | GCC_WARN_UNDECLARED_SELECTOR = YES; 314 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 315 | GCC_WARN_UNUSED_FUNCTION = YES; 316 | GCC_WARN_UNUSED_VARIABLE = YES; 317 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 318 | MTL_ENABLE_DEBUG_INFO = YES; 319 | ONLY_ACTIVE_ARCH = YES; 320 | SDKROOT = iphoneos; 321 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 322 | }; 323 | name = Debug; 324 | }; 325 | 194E82111A86FF06005E8AA6 /* Release */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ALWAYS_SEARCH_USER_PATHS = NO; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_MODULES = YES; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_WARN_BOOL_CONVERSION = YES; 334 | CLANG_WARN_CONSTANT_CONVERSION = YES; 335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 336 | CLANG_WARN_EMPTY_BODY = YES; 337 | CLANG_WARN_ENUM_CONVERSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 340 | CLANG_WARN_UNREACHABLE_CODE = YES; 341 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 342 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 343 | COPY_PHASE_STRIP = YES; 344 | ENABLE_NS_ASSERTIONS = NO; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNDECLARED_SELECTOR = YES; 350 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 351 | GCC_WARN_UNUSED_FUNCTION = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 354 | MTL_ENABLE_DEBUG_INFO = NO; 355 | SDKROOT = iphoneos; 356 | VALIDATE_PRODUCT = YES; 357 | }; 358 | name = Release; 359 | }; 360 | 194E82131A86FF06005E8AA6 /* Debug */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 364 | CODE_SIGN_IDENTITY = "iPhone Developer"; 365 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 366 | INFOPLIST_FILE = ProcessButton/Info.plist; 367 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | PROVISIONING_PROFILE = ""; 371 | TARGETED_DEVICE_FAMILY = "1,2"; 372 | }; 373 | name = Debug; 374 | }; 375 | 194E82141A86FF06005E8AA6 /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 379 | CODE_SIGN_IDENTITY = "iPhone Developer"; 380 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 381 | INFOPLIST_FILE = ProcessButton/Info.plist; 382 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 383 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | PROVISIONING_PROFILE = ""; 386 | TARGETED_DEVICE_FAMILY = "1,2"; 387 | }; 388 | name = Release; 389 | }; 390 | 194E82161A86FF06005E8AA6 /* Debug */ = { 391 | isa = XCBuildConfiguration; 392 | buildSettings = { 393 | BUNDLE_LOADER = "$(TEST_HOST)"; 394 | FRAMEWORK_SEARCH_PATHS = ( 395 | "$(SDKROOT)/Developer/Library/Frameworks", 396 | "$(inherited)", 397 | ); 398 | GCC_PREPROCESSOR_DEFINITIONS = ( 399 | "DEBUG=1", 400 | "$(inherited)", 401 | ); 402 | INFOPLIST_FILE = ProcessButtonTests/Info.plist; 403 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ProcessButton.app/ProcessButton"; 406 | }; 407 | name = Debug; 408 | }; 409 | 194E82171A86FF06005E8AA6 /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | BUNDLE_LOADER = "$(TEST_HOST)"; 413 | FRAMEWORK_SEARCH_PATHS = ( 414 | "$(SDKROOT)/Developer/Library/Frameworks", 415 | "$(inherited)", 416 | ); 417 | INFOPLIST_FILE = ProcessButtonTests/Info.plist; 418 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ProcessButton.app/ProcessButton"; 421 | }; 422 | name = Release; 423 | }; 424 | /* End XCBuildConfiguration section */ 425 | 426 | /* Begin XCConfigurationList section */ 427 | 194E81EE1A86FF06005E8AA6 /* Build configuration list for PBXProject "ProcessButton" */ = { 428 | isa = XCConfigurationList; 429 | buildConfigurations = ( 430 | 194E82101A86FF06005E8AA6 /* Debug */, 431 | 194E82111A86FF06005E8AA6 /* Release */, 432 | ); 433 | defaultConfigurationIsVisible = 0; 434 | defaultConfigurationName = Release; 435 | }; 436 | 194E82121A86FF06005E8AA6 /* Build configuration list for PBXNativeTarget "ProcessButton" */ = { 437 | isa = XCConfigurationList; 438 | buildConfigurations = ( 439 | 194E82131A86FF06005E8AA6 /* Debug */, 440 | 194E82141A86FF06005E8AA6 /* Release */, 441 | ); 442 | defaultConfigurationIsVisible = 0; 443 | defaultConfigurationName = Release; 444 | }; 445 | 194E82151A86FF06005E8AA6 /* Build configuration list for PBXNativeTarget "ProcessButtonTests" */ = { 446 | isa = XCConfigurationList; 447 | buildConfigurations = ( 448 | 194E82161A86FF06005E8AA6 /* Debug */, 449 | 194E82171A86FF06005E8AA6 /* Release */, 450 | ); 451 | defaultConfigurationIsVisible = 0; 452 | defaultConfigurationName = Release; 453 | }; 454 | /* End XCConfigurationList section */ 455 | }; 456 | rootObject = 194E81EB1A86FF06005E8AA6 /* Project object */; 457 | } 458 | --------------------------------------------------------------------------------