├── Screenshots └── Animation.gif ├── README.md ├── SwiftCoreAnimationFun.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── SwiftCoreAnimationFun ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── ViewController.swift ├── Info.plist ├── CAAnimation+Closures.swift ├── AppDelegate.swift ├── Base.lproj │ └── Main.storyboard └── AnimationView.swift ├── SwiftCoreAnimationFunTests ├── Info.plist └── SwiftCoreAnimationFunTests.swift ├── LICENSE └── .gitignore /Screenshots/Animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangyandongnx/Swift-CoreAnimation/HEAD/Screenshots/Animation.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Core Animation Example with Swift 2 | ========= 3 | A learning-by-doing project for Swift. 4 | 5 | A simple demo on how to implement the animation like the screenshot below. 6 | 7 | ## Screenshots ## 8 | 9 | ![Screenshots](Screenshots/Animation.gif) -------------------------------------------------------------------------------- /SwiftCoreAnimationFun.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftCoreAnimationFun/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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SwiftCoreAnimationFun/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SwiftCoreAnimationFunTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.invisiblebyte.${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 | -------------------------------------------------------------------------------- /SwiftCoreAnimationFun/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SwiftCoreAnimationFun 4 | // 5 | // Created by Wang Yandong on 6/13/14. 6 | // Copyright (c) 2014 Wang Yandong. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet var animationView : AnimationView? 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | // Do any additional setup after loading the view, typically from a nib. 17 | } 18 | 19 | override func didReceiveMemoryWarning() { 20 | super.didReceiveMemoryWarning() 21 | // Dispose of any resources that can be recreated. 22 | } 23 | 24 | override func viewDidAppear(animated: Bool) { 25 | super.viewDidAppear(animated) 26 | 27 | animationView!.playAnimation() 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /SwiftCoreAnimationFunTests/SwiftCoreAnimationFunTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftCoreAnimationFunTests.swift 3 | // SwiftCoreAnimationFunTests 4 | // 5 | // Created by Wang Yandong on 6/13/14. 6 | // Copyright (c) 2014 Wang Yandong. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class SwiftCoreAnimationFunTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Wang Yandong 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. -------------------------------------------------------------------------------- /SwiftCoreAnimationFun/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.invisiblebyte.${PRODUCT_NAME:rfc1034identifier} 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 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /SwiftCoreAnimationFun/CAAnimation+Closures.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CAAnimation+Closures.swift 3 | // SwiftCoreAnimationFun 4 | // 5 | // Created by Wang Yandong on 6/13/14. 6 | // Copyright (c) 2014 Wang Yandong. All rights reserved. 7 | // 8 | 9 | //import Foundation 10 | //import QuartzCore 11 | // 12 | //class CAAnimationDelagate: NSObject { 13 | // 14 | // var didStar: ((CAAnimation!) -> Void)? 15 | // var didStop: ((CAAnimation!, Bool) -> Void)? 16 | // 17 | // override func animationDidStart(anim: CAAnimation!) { 18 | // if (nil != didStar) { 19 | // didStar!(anim) 20 | // } 21 | // } 22 | // 23 | // override func animationDidStop(anim: CAAnimation!, finished flag: Bool) { 24 | // if (nil != didStop) { 25 | // didStop!(anim, flag) 26 | // } 27 | // } 28 | // 29 | //} 30 | // 31 | //extension CAAnimation { 32 | // 33 | // var didStart: ((CAAnimation!) -> Void)? { 34 | // get { 35 | // if let delegate = self.delegate as? CAAnimationDelagate { 36 | // return delegate.didStar 37 | // } 38 | // 39 | // return nil 40 | // } 41 | // 42 | // set { 43 | // if let delegate = self.delegate as? CAAnimationDelagate { 44 | // delegate.didStar = newValue 45 | // } else { 46 | // var delegate = CAAnimationDelagate() 47 | // delegate.didStar = newValue 48 | // self.delegate = delegate 49 | // } 50 | // } 51 | // } 52 | // 53 | // var didStop: ((CAAnimation!, Bool) -> Void)? { 54 | // get { 55 | // if let delegate = self.delegate as? CAAnimationDelagate { 56 | // return delegate.didStop 57 | // } 58 | // 59 | // return nil 60 | // } 61 | // 62 | // set { 63 | // if let delegate = self.delegate as? CAAnimationDelagate { 64 | // delegate.didStop = newValue 65 | // } else { 66 | // var delegate = CAAnimationDelagate() 67 | // delegate.didStop = newValue 68 | // self.delegate = delegate 69 | // } 70 | // } 71 | // } 72 | // 73 | //} -------------------------------------------------------------------------------- /SwiftCoreAnimationFun/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftCoreAnimationFun 4 | // 5 | // Created by Wang Yandong on 6/13/14. 6 | // Copyright (c) 2014 Wang Yandong. 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: NSDictionary?) -> 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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ######################### 2 | # .gitignore file for Xcode4 / OS X Source projects 3 | # 4 | # Version 2.0 5 | # For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects 6 | # 7 | # 2013 updates: 8 | # - fixed the broken "save personal Schemes" 9 | # 10 | # NB: if you are storing "built" products, this WILL NOT WORK, 11 | # and you should use a different .gitignore (or none at all) 12 | # This file is for SOURCE projects, where there are many extra 13 | # files that we want to exclude 14 | # 15 | ######################### 16 | 17 | ##### 18 | # OS X temporary files that should never be committed 19 | 20 | .DS_Store 21 | *.swp 22 | *.lock 23 | profile 24 | *.xccheckout 25 | .idea 26 | .sort-Xcode-project-file 27 | Pods 28 | 29 | 30 | #### 31 | # Xcode temporary files that should never be committed 32 | # 33 | # NB: NIB/XIB files still exist even on Storyboard projects, so we want this... 34 | 35 | *~.nib 36 | 37 | 38 | #### 39 | # Xcode build files - 40 | # 41 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData" 42 | 43 | DerivedData/ 44 | 45 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build" 46 | 47 | build/ 48 | 49 | 50 | ##### 51 | # Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups) 52 | # 53 | # This is complicated: 54 | # 55 | # SOMETIMES you need to put this file in version control. 56 | # Apple designed it poorly - if you use "custom executables", they are 57 | # saved in this file. 58 | # 99% of projects do NOT use those, so they do NOT want to version control this file. 59 | # ..but if you're in the 1%, comment out the line "*.pbxuser" 60 | 61 | *.pbxuser 62 | *.mode1v3 63 | *.mode2v3 64 | *.perspectivev3 65 | # NB: also, whitelist the default ones, some projects need to use these 66 | !default.pbxuser 67 | !default.mode1v3 68 | !default.mode2v3 69 | !default.perspectivev3 70 | 71 | 72 | #### 73 | # Xcode 4 - semi-personal settings 74 | # 75 | # 76 | # OPTION 1: --------------------------------- 77 | # throw away ALL personal settings (including custom schemes! 78 | # - unless they are "shared") 79 | # 80 | # NB: this is exclusive with OPTION 2 below 81 | xcuserdata 82 | 83 | # OPTION 2: --------------------------------- 84 | # get rid of ALL personal settings, but KEEP SOME OF THEM 85 | # - NB: you must manually uncomment the bits you want to keep 86 | # 87 | # NB: this is exclusive with OPTION 1 above 88 | # 89 | #xcuserdata/**/* 90 | 91 | # (requires option 2 above): Personal Schemes 92 | # 93 | #!xcuserdata/**/xcschemes/* 94 | 95 | #### 96 | # XCode 4 workspaces - more detailed 97 | # 98 | # Workspaces are important! They are a core feature of Xcode - don't exclude them :) 99 | # 100 | # Workspace layout is quite spammy. For reference: 101 | # 102 | # /(root)/ 103 | # /(project-name).xcodeproj/ 104 | # project.pbxproj 105 | # /project.xcworkspace/ 106 | # contents.xcworkspacedata 107 | # /xcuserdata/ 108 | # /(your name)/xcuserdatad/ 109 | # UserInterfaceState.xcuserstate 110 | # /xcsshareddata/ 111 | # /xcschemes/ 112 | # (shared scheme name).xcscheme 113 | # /xcuserdata/ 114 | # /(your name)/xcuserdatad/ 115 | # (private scheme).xcscheme 116 | # xcschememanagement.plist 117 | # 118 | # 119 | 120 | #### 121 | # Xcode 4 - Deprecated classes 122 | # 123 | # Allegedly, if you manually "deprecate" your classes, they get moved here. 124 | # 125 | # We're using source-control, so this is a "feature" that we do not want! 126 | 127 | *.moved-aside 128 | 129 | 130 | #### 131 | # UNKNOWN: recommended by others, but I can't discover what these files are 132 | # 133 | # ...none. Everything is now explained. -------------------------------------------------------------------------------- /SwiftCoreAnimationFun/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /SwiftCoreAnimationFun/AnimationView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimationView.swift 3 | // SwiftCoreAnimationFun 4 | // 5 | // Created by Wang Yandong on 6/13/14. 6 | // Copyright (c) 2014 Wang Yandong. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import QuartzCore 11 | 12 | class AnimationView: UIView { 13 | 14 | var baseLayer = CALayer() 15 | let baseCornerRadius: CGFloat = 50.0 16 | let baseDimension: CGFloat = 240.0 17 | let guideLineColor = UIColor.lightGrayColor() 18 | let animationDurations = [0.4, 0.4, 0.6, 0.6, 0.8] 19 | 20 | override init(frame: CGRect) { 21 | super.init(frame: frame) 22 | 23 | setup() 24 | } 25 | 26 | required init(coder aDecoder: NSCoder) { 27 | super.init(coder: aDecoder) 28 | 29 | setup() 30 | } 31 | 32 | override func layoutSubviews() { 33 | super.layoutSubviews() 34 | 35 | baseLayer.position = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2) 36 | } 37 | 38 | func setup() { 39 | self.layer.addSublayer(baseLayer) 40 | 41 | baseLayer.bounds = CGRectMake(0, 0, baseDimension, baseDimension) 42 | baseLayer.position = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2) 43 | baseLayer.borderColor = guideLineColor.CGColor 44 | baseLayer.borderWidth = 1 45 | baseLayer.cornerRadius = baseDimension / 2 46 | } 47 | 48 | func playAnimation() { 49 | self.prepareAnimation() 50 | self.setupAnimation() 51 | } 52 | 53 | func prepareAnimation() { 54 | if nil != baseLayer.sublayers { 55 | for subLayer in baseLayer.sublayers { 56 | subLayer.removeAllAnimations() 57 | } 58 | baseLayer.sublayers = nil 59 | } 60 | baseLayer.removeAllAnimations() 61 | } 62 | 63 | func setupAnimation() { 64 | self.animationPhase0(didStop: { [weak self] (animation: CAAnimation!, finished: Bool) -> Void in 65 | self!.animationPhase1() 66 | 67 | // Animation pipeline 68 | // 69 | // |===== (phase 1) =====| 70 | // |===== (phase 2) =====| 71 | // |===== (phase 3) =====| 72 | // |===== (phase 4) =====| 73 | // 74 | // --------------------------- time ---------------------------> 75 | // 76 | // Please refer "Animation Types and Timing Programming Guide" for how to implement this properly. 77 | // I just use delay for now. 78 | 79 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(self!.animationDurations[1] * 0.5 * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), { 80 | self!.animationPhase2() 81 | 82 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(self!.animationDurations[2] * 0.5 * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), { 83 | self!.animationPhase3() 84 | 85 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(self!.animationDurations[3] * 0.8 * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), { 86 | self!.animationPhase4() 87 | }) 88 | }) 89 | }) 90 | }) 91 | } 92 | 93 | func circleAnimationElements(circles: Array<(center: CGPoint, radius: CGFloat)>!) -> (Array<(CALayer, CAAnimation)>!) { 94 | var elements = Array<(CALayer, CAAnimation)>() 95 | 96 | for circle in circles { 97 | var layer = CAShapeLayer() 98 | self.baseLayer.addSublayer(layer) 99 | layer.fillColor = UIColor.clearColor().CGColor 100 | layer.strokeColor = guideLineColor.CGColor 101 | layer.lineWidth = 1 102 | layer.lineCap = kCALineCapRound.substringFromIndex(0) 103 | layer.opacity = 0 104 | layer.path = UIBezierPath(arcCenter: circle.center, radius: 0.001, startAngle: 0, endAngle: CGFloat(M_PI) * 2, clockwise: true).CGPath 105 | 106 | var pathAnimation = CABasicAnimation(keyPath: "path") 107 | pathAnimation.toValue = UIBezierPath(arcCenter: circle.center, radius: circle.radius, startAngle: 0, endAngle: CGFloat(M_PI) * 2, clockwise: true).CGPath 108 | 109 | var opacityAnimation = CABasicAnimation(keyPath: "opacity") 110 | opacityAnimation.toValue = 1 111 | 112 | var animation = CAAnimationGroup() 113 | animation.animations = [pathAnimation, opacityAnimation] 114 | animation.removedOnCompletion = false 115 | animation.fillMode = kCAFillModeForwards.substringFromIndex(0) 116 | 117 | elements.append((layer, animation) as (CALayer, CAAnimation)) 118 | } 119 | 120 | return elements 121 | } 122 | 123 | func strokeAnimationElements(lines: Array<(from: CGPoint, to: CGPoint)>!, strokeEnd: CGFloat) -> (Array<(CALayer, CAAnimation)>!) { 124 | var elements = Array<(CALayer, CAAnimation)>() 125 | 126 | for line in lines { 127 | var layer = CAShapeLayer() 128 | baseLayer.addSublayer(layer) 129 | layer.fillColor = UIColor.clearColor().CGColor 130 | layer.strokeColor = guideLineColor.CGColor 131 | layer.lineWidth = 1 132 | layer.lineCap = kCALineCapRound.substringFromIndex(0) 133 | layer.opacity = 0 134 | 135 | var path = UIBezierPath() 136 | path.moveToPoint(line.from) 137 | path.addLineToPoint(line.to) 138 | layer.path = path.CGPath 139 | 140 | var strokeAnimation = CABasicAnimation(keyPath: "strokeEnd") 141 | strokeAnimation.fromValue = 0 142 | strokeAnimation.toValue = strokeEnd 143 | 144 | var opacityAnimation = CABasicAnimation(keyPath: "opacity") 145 | opacityAnimation.toValue = 1 146 | 147 | var animation = CAAnimationGroup() 148 | animation.animations = [strokeAnimation, opacityAnimation] 149 | animation.removedOnCompletion = false 150 | animation.fillMode = kCAFillModeForwards.substringFromIndex(0) 151 | 152 | elements.append((layer, animation) as (CALayer, CAAnimation)) 153 | } 154 | 155 | return elements 156 | } 157 | 158 | func applyAnimation(elements: Array<(CALayer, CAAnimation)>!, duration: CFTimeInterval, completion: (() -> Void)?) { 159 | CATransaction.begin() 160 | CATransaction.setAnimationDuration(duration) 161 | CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut.substringFromIndex(0))) 162 | CATransaction.setCompletionBlock(completion) 163 | for (layer, animation) in elements { 164 | layer.addAnimation(animation, forKey: "animation") 165 | } 166 | CATransaction.commit() 167 | } 168 | 169 | func animationPhase0(#didStop: ((CAAnimation!, Bool) -> Void)?) { 170 | var cornerRadiusAnimation = CABasicAnimation(keyPath: "cornerRadius") 171 | cornerRadiusAnimation.toValue = baseCornerRadius 172 | cornerRadiusAnimation.duration = animationDurations[0] 173 | cornerRadiusAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut.substringFromIndex(0)) 174 | cornerRadiusAnimation.removedOnCompletion = false 175 | cornerRadiusAnimation.fillMode = kCAFillModeForwards.substringFromIndex(0) 176 | cornerRadiusAnimation.didStop = didStop 177 | baseLayer.addAnimation(cornerRadiusAnimation, forKey: "cornerRadiusAnimation") 178 | } 179 | 180 | func animationPhase1() { 181 | let d = baseDimension 182 | let d3 = d / 3 183 | 184 | var lines = [ 185 | (from: CGPointMake(0, d3), to: CGPointMake(d, d3)), 186 | (from: CGPointMake(d, d3), to: CGPointMake(0, d3)), 187 | (from: CGPointMake(0, d3 * 2), to: CGPointMake(d, d3 * 2)), 188 | (from: CGPointMake(d, d3 * 2), to: CGPointMake(0, d3 * 2)), 189 | (from: CGPointMake(d3, 0), to: CGPointMake(d3, d)), 190 | (from: CGPointMake(d3, d), to: CGPointMake(d3, 0)), 191 | (from: CGPointMake(d3 * 2, 0), to: CGPointMake(d3 * 2, d)), 192 | (from: CGPointMake(d3 * 2, d), to: CGPointMake(d3 * 2, 0)), 193 | ] 194 | 195 | var elements = strokeAnimationElements(lines, strokeEnd: 0.5) 196 | applyAnimation(elements, duration: animationDurations[1], completion: nil) 197 | } 198 | 199 | func animationPhase2() { 200 | let d = baseDimension 201 | let d2 = d / 2 202 | 203 | var lines = [ 204 | (from: CGPointMake(d2, d2), to: CGPointMake(0, 0)), 205 | (from: CGPointMake(d2, d2), to: CGPointMake(d, 0)), 206 | (from: CGPointMake(d2, d2), to: CGPointMake(0, d)), 207 | (from: CGPointMake(d2, d2), to: CGPointMake(d, d)), 208 | ] 209 | 210 | var elements = strokeAnimationElements(lines, strokeEnd: 1) 211 | applyAnimation(elements, duration: animationDurations[2], completion: nil) 212 | } 213 | 214 | func animationPhase3() { 215 | let d = baseDimension 216 | let delta = baseCornerRadius * CGFloat(1 - sin(M_PI_4)) 217 | 218 | var lines = [ 219 | (from: CGPointMake(0, delta), to: CGPointMake(d, delta)), 220 | (from: CGPointMake(d, delta), to: CGPointMake(0, delta)), 221 | (from: CGPointMake(delta, 0), to: CGPointMake(delta, d)), 222 | (from: CGPointMake(delta, d), to: CGPointMake(delta, 0)), 223 | (from: CGPointMake(d - delta, 0), to: CGPointMake(d - delta, d)), 224 | (from: CGPointMake(d - delta, d), to: CGPointMake(d - delta, 0)), 225 | (from: CGPointMake(0, d - delta), to: CGPointMake(d, d - delta)), 226 | (from: CGPointMake(d, d - delta), to: CGPointMake(0, d - delta)), 227 | ] 228 | 229 | var elements = strokeAnimationElements(lines, strokeEnd: 0.5) 230 | applyAnimation(elements, duration: animationDurations[3], completion: nil) 231 | } 232 | 233 | func animationPhase4() { 234 | let d = baseDimension 235 | let d2 = d / 2 236 | let d6 = d / 6 237 | 238 | var lines = [ 239 | (from: CGPointMake(d2, d2), to: CGPointMake(d2, 0)), 240 | (from: CGPointMake(d2, d2), to: CGPointMake(0, d2)), 241 | (from: CGPointMake(d2, d2), to: CGPointMake(d, d2)), 242 | (from: CGPointMake(d2, d2), to: CGPointMake(d2, d)), 243 | ] 244 | 245 | var elements = strokeAnimationElements(lines, strokeEnd: 1) 246 | applyAnimation(elements, duration: animationDurations[4] * 0.4, completion: nil) 247 | 248 | var circles = [ 249 | (center: CGPointMake(d2, d2), radius: d2 - baseCornerRadius * (1 - CGFloat(sin(M_PI_4)))), 250 | (center: CGPointMake(d2, d2), radius: d6 / CGFloat(sin(M_PI_4))), 251 | (center: CGPointMake(d2, d2), radius: d6), 252 | ] 253 | 254 | var circleElements: Array<(CALayer, CAAnimation)> = circleAnimationElements(circles) 255 | 256 | CATransaction.begin() 257 | CATransaction.setAnimationDuration(animationDurations[4]) 258 | CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut.substringFromIndex(0))) 259 | CATransaction.setCompletionBlock({ [weak self] () -> Void in 260 | var delay = dispatch_time(DISPATCH_TIME_NOW, Int64(0.8 * Double(NSEC_PER_SEC))) 261 | dispatch_after(delay, dispatch_get_main_queue(), { 262 | self!.playAnimation() 263 | }) 264 | }) 265 | 266 | var interval = CACurrentMediaTime() 267 | for (index, (layer, animation)) in enumerate(circleElements) { 268 | animation.beginTime = interval + CFTimeInterval(index) * 0.2 269 | animation.duration = animationDurations[4] * (1 - 0.2 * Double(index)) 270 | layer.addAnimation(animation, forKey: "animation") 271 | } 272 | CATransaction.commit() 273 | } 274 | } 275 | 276 | // MARK: CAAnimation+Closures 277 | 278 | // NOTE: Due to bug of Xcode 6 Beta, I have to put the extension here. Or it will crash the compiler. 279 | // This bug was found in Xcode 6 Beta 1 and was fixed in Xcode 6 Beta 5. But it happends again in Xcode 6 Beta 6. 280 | 281 | class CAAnimationDelagate: NSObject { 282 | 283 | var didStar: ((CAAnimation!) -> Void)? 284 | var didStop: ((CAAnimation!, Bool) -> Void)? 285 | 286 | override func animationDidStart(anim: CAAnimation!) { 287 | if (nil != didStar) { 288 | didStar!(anim) 289 | } 290 | } 291 | 292 | override func animationDidStop(anim: CAAnimation!, finished flag: Bool) { 293 | if (nil != didStop) { 294 | didStop!(anim, flag) 295 | } 296 | } 297 | 298 | } 299 | 300 | extension CAAnimation { 301 | 302 | var didStart: ((CAAnimation!) -> Void)? { 303 | get { 304 | if let delegate = self.delegate as? CAAnimationDelagate { 305 | return delegate.didStar 306 | } 307 | 308 | return nil 309 | } 310 | 311 | set { 312 | if let delegate = self.delegate as? CAAnimationDelagate { 313 | delegate.didStar = newValue 314 | } else { 315 | var delegate = CAAnimationDelagate() 316 | delegate.didStar = newValue 317 | self.delegate = delegate 318 | } 319 | } 320 | } 321 | 322 | var didStop: ((CAAnimation!, Bool) -> Void)? { 323 | get { 324 | if let delegate = self.delegate as? CAAnimationDelagate { 325 | return delegate.didStop 326 | } 327 | 328 | return nil 329 | } 330 | 331 | set { 332 | if let delegate = self.delegate as? CAAnimationDelagate { 333 | delegate.didStop = newValue 334 | } else { 335 | var delegate = CAAnimationDelagate() 336 | delegate.didStop = newValue 337 | self.delegate = delegate 338 | } 339 | } 340 | } 341 | 342 | } 343 | -------------------------------------------------------------------------------- /SwiftCoreAnimationFun.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4C15DA12194ACA3F00DBFB1F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C15DA11194ACA3F00DBFB1F /* AppDelegate.swift */; }; 11 | 4C15DA14194ACA3F00DBFB1F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C15DA13194ACA3F00DBFB1F /* ViewController.swift */; }; 12 | 4C15DA17194ACA3F00DBFB1F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4C15DA15194ACA3F00DBFB1F /* Main.storyboard */; }; 13 | 4C15DA19194ACA3F00DBFB1F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4C15DA18194ACA3F00DBFB1F /* Images.xcassets */; }; 14 | 4C15DA25194ACA4000DBFB1F /* SwiftCoreAnimationFunTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C15DA24194ACA4000DBFB1F /* SwiftCoreAnimationFunTests.swift */; }; 15 | 4C15DA30194ACA5000DBFB1F /* CAAnimation+Closures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C15DA2E194ACA5000DBFB1F /* CAAnimation+Closures.swift */; }; 16 | 4C15DA31194ACA5000DBFB1F /* AnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C15DA2F194ACA5000DBFB1F /* AnimationView.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 4C15DA1F194ACA4000DBFB1F /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 4C15DA04194ACA3F00DBFB1F /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 4C15DA0B194ACA3F00DBFB1F; 25 | remoteInfo = SwiftCoreAnimationFun; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 4C15DA0C194ACA3F00DBFB1F /* SwiftCoreAnimationFun.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftCoreAnimationFun.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 4C15DA10194ACA3F00DBFB1F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 4C15DA11194ACA3F00DBFB1F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | 4C15DA13194ACA3F00DBFB1F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 34 | 4C15DA16194ACA3F00DBFB1F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | 4C15DA18194ACA3F00DBFB1F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 36 | 4C15DA1E194ACA4000DBFB1F /* SwiftCoreAnimationFunTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftCoreAnimationFunTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 4C15DA23194ACA4000DBFB1F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | 4C15DA24194ACA4000DBFB1F /* SwiftCoreAnimationFunTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftCoreAnimationFunTests.swift; sourceTree = ""; }; 39 | 4C15DA2E194ACA5000DBFB1F /* CAAnimation+Closures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CAAnimation+Closures.swift"; sourceTree = ""; }; 40 | 4C15DA2F194ACA5000DBFB1F /* AnimationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimationView.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 4C15DA09194ACA3F00DBFB1F /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | 4C15DA1B194ACA4000DBFB1F /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 4C15DA03194ACA3F00DBFB1F = { 62 | isa = PBXGroup; 63 | children = ( 64 | 4C15DA0E194ACA3F00DBFB1F /* SwiftCoreAnimationFun */, 65 | 4C15DA21194ACA4000DBFB1F /* SwiftCoreAnimationFunTests */, 66 | 4C15DA0D194ACA3F00DBFB1F /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 4C15DA0D194ACA3F00DBFB1F /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 4C15DA0C194ACA3F00DBFB1F /* SwiftCoreAnimationFun.app */, 74 | 4C15DA1E194ACA4000DBFB1F /* SwiftCoreAnimationFunTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 4C15DA0E194ACA3F00DBFB1F /* SwiftCoreAnimationFun */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 4C15DA2E194ACA5000DBFB1F /* CAAnimation+Closures.swift */, 83 | 4C15DA2F194ACA5000DBFB1F /* AnimationView.swift */, 84 | 4C15DA11194ACA3F00DBFB1F /* AppDelegate.swift */, 85 | 4C15DA13194ACA3F00DBFB1F /* ViewController.swift */, 86 | 4C15DA15194ACA3F00DBFB1F /* Main.storyboard */, 87 | 4C15DA18194ACA3F00DBFB1F /* Images.xcassets */, 88 | 4C15DA0F194ACA3F00DBFB1F /* Supporting Files */, 89 | ); 90 | path = SwiftCoreAnimationFun; 91 | sourceTree = ""; 92 | }; 93 | 4C15DA0F194ACA3F00DBFB1F /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 4C15DA10194ACA3F00DBFB1F /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | 4C15DA21194ACA4000DBFB1F /* SwiftCoreAnimationFunTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 4C15DA24194ACA4000DBFB1F /* SwiftCoreAnimationFunTests.swift */, 105 | 4C15DA22194ACA4000DBFB1F /* Supporting Files */, 106 | ); 107 | path = SwiftCoreAnimationFunTests; 108 | sourceTree = ""; 109 | }; 110 | 4C15DA22194ACA4000DBFB1F /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 4C15DA23194ACA4000DBFB1F /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | 4C15DA0B194ACA3F00DBFB1F /* SwiftCoreAnimationFun */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = 4C15DA28194ACA4000DBFB1F /* Build configuration list for PBXNativeTarget "SwiftCoreAnimationFun" */; 124 | buildPhases = ( 125 | 4C15DA08194ACA3F00DBFB1F /* Sources */, 126 | 4C15DA09194ACA3F00DBFB1F /* Frameworks */, 127 | 4C15DA0A194ACA3F00DBFB1F /* Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = SwiftCoreAnimationFun; 134 | productName = SwiftCoreAnimationFun; 135 | productReference = 4C15DA0C194ACA3F00DBFB1F /* SwiftCoreAnimationFun.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | 4C15DA1D194ACA4000DBFB1F /* SwiftCoreAnimationFunTests */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 4C15DA2B194ACA4000DBFB1F /* Build configuration list for PBXNativeTarget "SwiftCoreAnimationFunTests" */; 141 | buildPhases = ( 142 | 4C15DA1A194ACA4000DBFB1F /* Sources */, 143 | 4C15DA1B194ACA4000DBFB1F /* Frameworks */, 144 | 4C15DA1C194ACA4000DBFB1F /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | 4C15DA20194ACA4000DBFB1F /* PBXTargetDependency */, 150 | ); 151 | name = SwiftCoreAnimationFunTests; 152 | productName = SwiftCoreAnimationFunTests; 153 | productReference = 4C15DA1E194ACA4000DBFB1F /* SwiftCoreAnimationFunTests.xctest */; 154 | productType = "com.apple.product-type.bundle.unit-test"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | 4C15DA04194ACA3F00DBFB1F /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 0600; 163 | ORGANIZATIONNAME = "Wang Yandong"; 164 | TargetAttributes = { 165 | 4C15DA0B194ACA3F00DBFB1F = { 166 | CreatedOnToolsVersion = 6.0; 167 | }; 168 | 4C15DA1D194ACA4000DBFB1F = { 169 | CreatedOnToolsVersion = 6.0; 170 | TestTargetID = 4C15DA0B194ACA3F00DBFB1F; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = 4C15DA07194ACA3F00DBFB1F /* Build configuration list for PBXProject "SwiftCoreAnimationFun" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = 4C15DA03194ACA3F00DBFB1F; 183 | productRefGroup = 4C15DA0D194ACA3F00DBFB1F /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | 4C15DA0B194ACA3F00DBFB1F /* SwiftCoreAnimationFun */, 188 | 4C15DA1D194ACA4000DBFB1F /* SwiftCoreAnimationFunTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | 4C15DA0A194ACA3F00DBFB1F /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | 4C15DA17194ACA3F00DBFB1F /* Main.storyboard in Resources */, 199 | 4C15DA19194ACA3F00DBFB1F /* Images.xcassets in Resources */, 200 | ); 201 | runOnlyForDeploymentPostprocessing = 0; 202 | }; 203 | 4C15DA1C194ACA4000DBFB1F /* Resources */ = { 204 | isa = PBXResourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | ); 208 | runOnlyForDeploymentPostprocessing = 0; 209 | }; 210 | /* End PBXResourcesBuildPhase section */ 211 | 212 | /* Begin PBXSourcesBuildPhase section */ 213 | 4C15DA08194ACA3F00DBFB1F /* Sources */ = { 214 | isa = PBXSourcesBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | 4C15DA30194ACA5000DBFB1F /* CAAnimation+Closures.swift in Sources */, 218 | 4C15DA14194ACA3F00DBFB1F /* ViewController.swift in Sources */, 219 | 4C15DA12194ACA3F00DBFB1F /* AppDelegate.swift in Sources */, 220 | 4C15DA31194ACA5000DBFB1F /* AnimationView.swift in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | 4C15DA1A194ACA4000DBFB1F /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 4C15DA25194ACA4000DBFB1F /* SwiftCoreAnimationFunTests.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXTargetDependency section */ 235 | 4C15DA20194ACA4000DBFB1F /* PBXTargetDependency */ = { 236 | isa = PBXTargetDependency; 237 | target = 4C15DA0B194ACA3F00DBFB1F /* SwiftCoreAnimationFun */; 238 | targetProxy = 4C15DA1F194ACA4000DBFB1F /* PBXContainerItemProxy */; 239 | }; 240 | /* End PBXTargetDependency section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | 4C15DA15194ACA3F00DBFB1F /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 4C15DA16194ACA3F00DBFB1F /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 4C15DA26194ACA4000DBFB1F /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ALWAYS_SEARCH_USER_PATHS = NO; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu99; 275 | GCC_DYNAMIC_NO_PIC = NO; 276 | GCC_OPTIMIZATION_LEVEL = 0; 277 | GCC_PREPROCESSOR_DEFINITIONS = ( 278 | "DEBUG=1", 279 | "$(inherited)", 280 | ); 281 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 284 | GCC_WARN_UNDECLARED_SELECTOR = YES; 285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 286 | GCC_WARN_UNUSED_FUNCTION = YES; 287 | GCC_WARN_UNUSED_VARIABLE = YES; 288 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 289 | METAL_ENABLE_DEBUG_INFO = YES; 290 | ONLY_ACTIVE_ARCH = YES; 291 | SDKROOT = iphoneos; 292 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 293 | }; 294 | name = Debug; 295 | }; 296 | 4C15DA27194ACA4000DBFB1F /* Release */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ALWAYS_SEARCH_USER_PATHS = NO; 300 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 301 | CLANG_CXX_LIBRARY = "libc++"; 302 | CLANG_ENABLE_MODULES = YES; 303 | CLANG_ENABLE_OBJC_ARC = YES; 304 | CLANG_WARN_BOOL_CONVERSION = YES; 305 | CLANG_WARN_CONSTANT_CONVERSION = YES; 306 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 307 | CLANG_WARN_EMPTY_BODY = YES; 308 | CLANG_WARN_ENUM_CONVERSION = YES; 309 | CLANG_WARN_INT_CONVERSION = YES; 310 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 311 | CLANG_WARN_UNREACHABLE_CODE = YES; 312 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 313 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 314 | COPY_PHASE_STRIP = YES; 315 | ENABLE_NS_ASSERTIONS = NO; 316 | ENABLE_STRICT_OBJC_MSGSEND = YES; 317 | GCC_C_LANGUAGE_STANDARD = gnu99; 318 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 319 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 320 | GCC_WARN_UNDECLARED_SELECTOR = YES; 321 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 322 | GCC_WARN_UNUSED_FUNCTION = YES; 323 | GCC_WARN_UNUSED_VARIABLE = YES; 324 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 325 | METAL_ENABLE_DEBUG_INFO = NO; 326 | SDKROOT = iphoneos; 327 | VALIDATE_PRODUCT = YES; 328 | }; 329 | name = Release; 330 | }; 331 | 4C15DA29194ACA4000DBFB1F /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 335 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 336 | INFOPLIST_FILE = SwiftCoreAnimationFun/Info.plist; 337 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 338 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 339 | PRODUCT_NAME = "$(TARGET_NAME)"; 340 | }; 341 | name = Debug; 342 | }; 343 | 4C15DA2A194ACA4000DBFB1F /* Release */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 347 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 348 | INFOPLIST_FILE = SwiftCoreAnimationFun/Info.plist; 349 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | }; 353 | name = Release; 354 | }; 355 | 4C15DA2C194ACA4000DBFB1F /* Debug */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SwiftCoreAnimationFun.app/SwiftCoreAnimationFun"; 359 | FRAMEWORK_SEARCH_PATHS = ( 360 | "$(SDKROOT)/Developer/Library/Frameworks", 361 | "$(inherited)", 362 | ); 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | INFOPLIST_FILE = SwiftCoreAnimationFunTests/Info.plist; 368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 369 | METAL_ENABLE_DEBUG_INFO = YES; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | TEST_HOST = "$(BUNDLE_LOADER)"; 372 | }; 373 | name = Debug; 374 | }; 375 | 4C15DA2D194ACA4000DBFB1F /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SwiftCoreAnimationFun.app/SwiftCoreAnimationFun"; 379 | FRAMEWORK_SEARCH_PATHS = ( 380 | "$(SDKROOT)/Developer/Library/Frameworks", 381 | "$(inherited)", 382 | ); 383 | INFOPLIST_FILE = SwiftCoreAnimationFunTests/Info.plist; 384 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 385 | METAL_ENABLE_DEBUG_INFO = NO; 386 | PRODUCT_NAME = "$(TARGET_NAME)"; 387 | TEST_HOST = "$(BUNDLE_LOADER)"; 388 | }; 389 | name = Release; 390 | }; 391 | /* End XCBuildConfiguration section */ 392 | 393 | /* Begin XCConfigurationList section */ 394 | 4C15DA07194ACA3F00DBFB1F /* Build configuration list for PBXProject "SwiftCoreAnimationFun" */ = { 395 | isa = XCConfigurationList; 396 | buildConfigurations = ( 397 | 4C15DA26194ACA4000DBFB1F /* Debug */, 398 | 4C15DA27194ACA4000DBFB1F /* Release */, 399 | ); 400 | defaultConfigurationIsVisible = 0; 401 | defaultConfigurationName = Release; 402 | }; 403 | 4C15DA28194ACA4000DBFB1F /* Build configuration list for PBXNativeTarget "SwiftCoreAnimationFun" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | 4C15DA29194ACA4000DBFB1F /* Debug */, 407 | 4C15DA2A194ACA4000DBFB1F /* Release */, 408 | ); 409 | defaultConfigurationIsVisible = 0; 410 | defaultConfigurationName = Release; 411 | }; 412 | 4C15DA2B194ACA4000DBFB1F /* Build configuration list for PBXNativeTarget "SwiftCoreAnimationFunTests" */ = { 413 | isa = XCConfigurationList; 414 | buildConfigurations = ( 415 | 4C15DA2C194ACA4000DBFB1F /* Debug */, 416 | 4C15DA2D194ACA4000DBFB1F /* Release */, 417 | ); 418 | defaultConfigurationIsVisible = 0; 419 | defaultConfigurationName = Release; 420 | }; 421 | /* End XCConfigurationList section */ 422 | }; 423 | rootObject = 4C15DA04194ACA3F00DBFB1F /* Project object */; 424 | } 425 | --------------------------------------------------------------------------------