Swift extension which adds start, animating and completion closures for CAAnimation objects. Aka, CAAnimation + Closure / Block

Overview

Swift-CAAnimation-Closure

Swift extension which adds start, animating and completion closures for CAAnimation objects.

Aka, CAAnimation + Closure or CAAnimation + Block.

Preview

Start and Completion

demo-start-completion

Animating (Progress)

demo-animating

Installation

CocoaPods

use_frameworks!

pod 'Swift-CAAnimation-Closure', '~> 1.0'

Manually

Just add CAAnimation+Closure.swift file into your project.

API

CAAnimation API

let animation = CABasicAnimation(keyPath: "strokeEnd")
animation.duration = 2.0
animation.fromValue = 0.0
animation.toValue = 1.0

animation.start = {
    print("Woo, the animation starts!")
    // ...
}

animation.animating = { progress in
    print("progress: \(progress)")
    // ...
}

animation.completion = { finished in
    print("Awesome, the animation just finished! :)")
    // ...
}

layer.addAnimation(animation, forKey: "animationKey")

CALayer API

layer.addAnimation(strokeEndAnimation, forKey: "strokeEndAnimation") { finished in
	print("Animation is finished")
}

The MIT License (MIT)

The MIT License (MIT)

Copyright (c) 2015 Honghao Zhang 张宏昊

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge

You might also like...
iOS native app demo with Xcode and Swift using MVVM architecture and Apple's Combine framework for functional reactive programming, all with UIKit
iOS native app demo with Xcode and Swift using MVVM architecture and Apple's Combine framework for functional reactive programming, all with UIKit

iOS (Swift 5): MVVM test with Combine and UIKit MVVM and functional reactive programming (FRP) are very used in iOS development inside companies. Here

SwiftLint - A tool to enforce Swift style and conventions, loosely based on Swift Style Guide.
SwiftLint - A tool to enforce Swift style and conventions, loosely based on Swift Style Guide.

SwiftLint - A tool to enforce Swift style and conventions, loosely based on Swift Style Guide.

Sweet-swift - Make Swift Sweet by Gracefully Introducing Syntactic Sugar, Helper Functions and Common Utilities

Sweet Swift Make Swift Sweet by Gracefully Introducing Syntactic Sugar, Helper F

Explanations and samples about the Swift programming language
Explanations and samples about the Swift programming language

About Swift Contents Explanations and samples about: Swift Programming Language Swift Standard Library Target audience Developers familiar with object

This repo shows how to set up and use GitHub Actions as a CI for Swift Packages
This repo shows how to set up and use GitHub Actions as a CI for Swift Packages

SwiftPackageWithGithubActionsAsCI This repo shows how to set up and use GitHub Actions as a CI for Swift Packages. Available environments on GitHib Li

A Swift implementation of a Flickr-search application that uses MVVM and ReactiveCocoa
A Swift implementation of a Flickr-search application that uses MVVM and ReactiveCocoa

ReactiveCocoa, Swift and MVVM This application is a Swift-port of an MVVM / ReactiveCocoa example application I wrote a few months ago. Instructions T

SignalKit is a reactive Swift framework with focus on clean and readable API.
SignalKit is a reactive Swift framework with focus on clean and readable API.

Abstract SignalKit is a lightweight event and binding framework. The core of SignalKit is the Observable protocol. Each implementation of the Observab

👨‍💻Watch the latest and greatest conference videos on your Mac
👨‍💻Watch the latest and greatest conference videos on your Mac

Conferences.digital is the best way to watch the latest and greatest videos from your favourite developer conferences for free on your Mac. Either sea

A package to help track how often the user opened the app and if they opened it in the current version before.

AppOpenTracker AppOpenTracker provides an observable AppOpenTracker.shared instance that can be used to track the last version that the app was opened

Comments
  • CocoaPods support

    CocoaPods support

    CocoaPods are currently in beta for Swift, however I would love to have a possibility to integrate Swift-CAAnimation-Closure with my project via CocoaPods.

    Expectations:

    • create podspec
    • publish pod!
    opened by rad3ks 4
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
Releases(1.4)
Owner
HongHao Zhang
🔨
HongHao Zhang
ClosureReactor - Closure Reactor With Swift

ClosureReactor Example To run the example project, clone the repo, and run pod i

김영후(모바일) 0 Feb 11, 2022
A Swift package that adds some handy functions to String and NSMutableAttributedString

StringBooster StringBooster is a simple Swift package containing a few useful ex

B.T. Franklin 0 Dec 31, 2022
A browser extension for Safari that makes sure that cut, copy, and paste are enabled.

Paste for Safari A browser extension for Safari that makes sure that cut, copy, and paste are enabled. Notes This is pretty rough and does work. The v

Mark Ferlatte 1 Dec 20, 2022
🌊 Let your code flow. Extension methods for fluent syntax in Swift.

Flow ?? Let your code flow. This library provides a bunch of extension methods for a better fluent syntax in Swift. This style is very useful for some

Alejandro Martínez 100 Nov 30, 2022
FinderEx - MacOS Finder Sync Extension to Allow Adding Custom Actions

FinderEx MacOS Finder Sync Extension to Allow Adding Custom Actions Description

null 4 Jul 21, 2022
GM-Dragable - A DragableView extension for GM

GM-Dragable A DragableView extension for GM How to use it UIViewController try?

Gavin 0 Jan 20, 2022
A fitness application using swift which can help user to hold a better sleep

Natcap - Good for your sleep This is a fitness application which can help user to hold a better sleep which depends on their previous sleeping habit.

Mill 0 Dec 13, 2021
Jared Watson 0 Jan 8, 2022
This is Github user search demo app which made by many variety of design patterns.

iOSDesignPatternSamples This is Github user search demo app which made by many variety of design patterns. Application Structure SearchViewController.

Taiki Suzuki 679 Dec 11, 2022
A framework to create proxies for XCBBuildService, which allows for custom Xcode build integrations.

XCBBuildServiceProxyKit XCBBuildServiceProxyKit is a framework that enables you to write a proxy for Xcode's XCBBuildService, which enables you to ext

Mobile Native Foundation 30 Dec 28, 2022