Code Monkey home page Code Monkey logo

easyanimation's Issues

Getting two errors

In the EasyAnimation.swift file I get two different error messages in
"anim = RBBSpringAnimation(keyPath: pending.keyPath)
if let anim = anim as? RBBSpringAnimation {"

  1. Use of unresolved identifier 'RBBSpringAnimation'
  2. Use of undeclared type 'RBBSpringAnimation'

You have a solution for this?

Co-maintainer needed

Hey everyone,
I recently got a beautiful newborn at home and it feels it'll be a bit difficult to add some new and fresh features to EasyAnimation... Should anyone feel like digging into the code and maybe add some new stuff folks would find cool - let me know :)

best, Marin

How to use with Carthage?

Hello,
'Installation' mentioned that Carthage is supported. However, when I try to github “EasyAnimation” on my Cartfile, I get an error.

Spring Animation

I think there is some small bug with the spring animation. The completion block it's never been called.

        var newFrame = view.frame
        newFrame.size.height = 50

        UIView.animate(
            withDuration: 1.25,
            delay: 0,
            usingSpringWithDamping: 0.65,
            initialSpringVelocity: 0.75,
            options: [],
            animations: {
                self.testLayer.frame = newFrame
        }) { _ in
            print("Tralala!")
        }

Non-swizzling version?

Hello!

This library seems like an amazing tool.
There's just one thing that bothers me, which is the replacing of native methods.

Swizzling is generally not safe, and should be reserved for rare bug fixing problems.

Is there a chance that you will have a non swizzling version?

Maybe have an EasyAnimation class with the same static functions for animations, and a call that initiates the swizzlings for those interested?..

Thanks!

layer only animations

if you animate only layer properties in an animation block UIKit executes the completion block immediately

Reset view position

Hi!! thanks a lot, a great repo! i encountered a problem, i don't know how to reset the view position!! sorry for this silly question but i've been trying to figure it out :/

Unable to install via CocoaPods?

Hey Marin, I'm new to using CocoaPods so maybe I'm just doing something wrong.

Here's my cocoapods gem setup:

$ gem list cocoapods

*** LOCAL GEMS ***

cocoapods (0.38.0)
cocoapods-core (0.38.0)
cocoapods-downloader (0.9.1)
cocoapods-plugins (0.4.2)
cocoapods-stats (0.5.3)
cocoapods-trunk (0.6.1)
cocoapods-try (0.4.5)

And here is my Podfile:

$ cat Podfile 
# Uncomment this line to define a global platform for your project
platform :ios, '7.0'

target 'FooApp' do
  pod 'EasyAnimation'
end

target 'FooAppTests' do
end

Finally, here is the output when I run pod install in my project:

$ pod install
Updating local specs repositories
Analyzing dependencies
[!] Unable to satisfy the following requirements:

- `EasyAnimation` required by `Podfile`

Any suggestions?

EasyAnimation breaks popover presentation animation

Adding EasyAnimation to a project breaks the presentation animation for a UIPopoverController, whether being used explicitly with UIViewController and a UIPopoverController, or implicitly by setting the modalPresentationStyle for a UIViewController to UIModalPresentationStylePopover and setting a sourceView and sourceRect. The popover still animates into place but various elements of the popover are out of place until they finish animating, and the dimmed out background view jumps up into place.

I have been able to consistently replicate this with EasyAnimation 0.7 + 1.0 with the following steps:

  • Create a new project and add EasyAnimation via CocoaPods. Open the new workspace.
  • Add a button to the storyboard for the default ViewController class.
  • Add a IBOutlet for a UIButton:
    @IBOutlet private weak var button: UIButton!
  • Add the following IBAction:
    @IBAction func buttonPressed(sender: UIButton) {
        let alertController = UIAlertController(title: "Test", message: "test", preferredStyle: UIAlertControllerStyle.ActionSheet)
        alertController.modalPresentationStyle = UIModalPresentationStyle.Popover
        alertController.popoverPresentationController?.sourceView = self.view
        alertController.popoverPresentationController?.sourceRect = self.button.frame
        self.presentViewController(alertController, animated: true, completion: nil)
    }
  • Connect the UIButton in the storyboard to the outlet and the action.
  • Run and tap on the button to observe the broken animation.

Animations in chain seam to get cached. Adding other animations to a view that is finished animating restars the whole chain.

I used it and apparently a view that you chain animations on retains those. When you later trigger animations on the same view the previously chained animations get triggered again. Maybe there is a cleanup I don’t know about?

Reproduce

  1. Add a view and chain some animations
  2. Animate the chain
  3. When it is finished add some other animations in code
  4. Start that animation.

Bug
The chained animations in 3 are added to the new animations. I don't feel this is the expected behaviour?

Sometimes Chain-Repeat Animation do not work as I expect

UIView.animateAndChainWithDuration(1.0, delay: 0.0, options: nil, animations: { () -> Void in
    self.layer.borderColor = flashBorderColor.CGColor
}, completion: nil).animateWithDuration(1.0, delay: 0.0, options: UIViewAnimationOptions.Repeat, animations: { () -> Void in
    self.layer.borderColor = originBorderCGColor
}, completion: nil)

I expect it could flash borderColor, but not works for me.
already read the demoApp's example, can not figure out what's going wrong here, pls help :(

Use of unresolved identifier 'EAAnimationFuture'

i'm to keep track of chains like this chains = [EAAnimationFuture]() so i can call like this.
chains.map { $0.cancelAnimationChain() } but it saying Use of unresolved identifier 'EAAnimationFuture'

Question about "pending:" print statements

Hey, awesome library. I've got a low-priority question. I'm seeing this in my console when dismissing a view controller back to one of my views where I have a collection view with EasyAnimation running in the cells:

pending: bounds from NSRect: {{0, 0}, {0, 0}} to Optional(NSRect: {{0, 0}, {414, 0}})
pending: position from NSPoint: {0, 0} to Optional(NSPoint: {207, 1})
pending: bounds from NSRect: {{0, 0}, {0, 0}} to Optional(NSRect: {{0, 0}, {414, 0}})
pending: position from NSPoint: {0, 0} to Optional(NSPoint: {207, 0})
pending: bounds from NSRect: {{0, 0}, {0, 0}} to Optional(NSRect: {{0, 0}, {8, 13}})
pending: position from NSPoint: {0, 0} to Optional(NSPoint: {402, -0.5})
pending: position from NSPoint: {207, 1} to Optional(NSPoint: {207, 1})
pending: opacity from 1 to Optional(1)
pending: bounds from NSRect: {{0, 0}, {0, 0}} to Optional(NSRect: {{0, 0}, {141.66666666666666, 253}})
pending: position from NSPoint: {0, 0} to Optional(NSPoint: {70.833333333333329, 126.5})

I am not so worried about the statements printing, but I'm unsure how to react. Does this necessarily mean I'm misusing animations in some way, or is EasyAnimation just letting me know what's going on?

Animations going in reverse

I have a label on my xib with auto layout constraints centering it vertically and horizontally. I just want to move my label to the right, like in your example code:

UIView.animateWithDuration(2.0, animations: {
            self.label.layer.position.x = 200.0
        }) 

But when I run this, my label loads on the screen, off to the right and then animates back to the center. It's the opposite of what I would expect.

Is this due to the layout constraints?

Animating properties of more than one elements

Hello,

I'm using this to animate properties of two elements, but the second one starts just before the first one stops they don't animate in parallel.

UIView.animateWithDuration(0.6, delay: 0.0,
                options: [.CurveLinear],
                animations: {
                    let viewWidth = self.view.frame.width
                    self.settingsView.frame.size.width = ((viewWidth-60) * 2)
                    self.view.frame.origin.x = viewWidth - 60
                }, completion: { (done:Bool)->Void in
                    if done == true {

                    }
            })

Am I doing this wrong? Which is the correct way of animating more than one element properties?

Thanks in advance!

UITabBarItems weird behaviour

Hi!

First of all thanks for great library! It's really awesome. I integrated it in project that I'm currently working on and encountered strange behaviour. When presenting UITabBarController without animation:

let tabBarController = UITabBarController()
// setup tabBarController 

//present tab bar controller *without* animation:
presentViewController(tabBarController, animated: false, completion: nil)

UITabBarItems are going crazy and change their position for a short time. Even without integrating EasyAnimation (probably because of method swizzling). Let's take a look:

bug

I prepared sample project which hopefully will be useful. It's vanilla Single View Application.

Animation completion will not work under some circumstances

I need to remove all the animations on some layer under specific condition. But after I did something like this, it become impossible to add animation any more. How could I cancel all animation without hurt it?

self.spriteLayer.removeAllAnimations()

Module compiled with Swift 4.0.3 cannot be imported in Swift 4.1

Just putting a heads up here that I got the error "Module compiled with Swift 4.0.3 cannot be imported in Swift 4.1" after updating the Xcode 9.3 and iOS 11.3 to work with ARKit 1.5.

Hopefully updating the module won't be a big deal to clear up this issue.

Disable aggressive debug logging

Our console is getting seriously spammed with pending: bla bla because of EasyAnimation:L274:

print("pending: \(anim.keyPath) from \(anim.fromValue) to \(anim.layer.value(forKeyPath: anim.keyPath))")

Is it possible to either remove it all together or to set a flag that enables/disables this logging?

Seems to crash in Xcode7.3 / iOS 9.3

crashes in CALayer extension on

private static func replaceAnimationMethods() { //replace actionForKey method_exchangeImplementations( class_getInstanceMethod(self, Selector("actionForKey:")), class_getInstanceMethod(self, Selector("EA_actionForKey:"))) }

EXC_BAD_ACCESS

Objective c enable

Hi, thanks for this very great library!

However the enable() function is no more accessible from objective c while the class is marked @objc.

Or am I missing something?

Regards,

2.0.0 concerns

I just installed 2.0.0 and ran my app without doing any changes to my code.

EasyAnimation still swizzles without having called EasyAnimation.enable().

EasyAnimation crash in my project.

Xcode 7.1, Swift 2.0

I installed EasyAnimation via cocoapods.

When I launched my app, it stopped at:

private static func replaceAnimationMethods() {
    //replace actionForKey
    method_exchangeImplementations(
        class_getInstanceMethod(self, "actionForKey:"),
        class_getInstanceMethod(self, "EA_actionForKey:"))
}
  • thread #2: tid = 0x278da, 0x00000001008e6c90 libswiftCore.dylib`swift_unknownRelease + 24, stop reason = EXC_BAD_ACCESS (code=1, address=0x20)

Crashes on device

Every time I try to run on the device I get the following crash:

thread #2: tid = 0x153bbd, 0x00000001020dac90 libswiftCore.dylib`swift_unknownRelease + 24, stop reason = EXC_BAD_ACCESS (code=1, address=0x20)
    frame #0: 0x00000001020dac90 libswiftCore.dylib`swift_unknownRelease + 24
    frame #1: 0x0000000102fbd578 libswiftObjectiveC.dylib`function signature specialization <Arg[0] = Owned To Guaranteed and Exploded, Arg[1] = Dead> of ObjectiveC.Selector.init (ObjectiveC.Selector.Type)(stringLiteral : Swift.String) -> ObjectiveC.Selector + 240
    frame #2: 0x0000000102fbcb48 libswiftObjectiveC.dylib`ObjectiveC.Selector.init (ObjectiveC.Selector.Type)(stringLiteral : Swift.String) -> ObjectiveC.Selector + 20
    frame #3: 0x0000000101671e74 EasyAnimation`static ext.EasyAnimation.__ObjC.CALayer.(self=CALayer) (__ObjC.CALayer.Type)() -> () + 140 at EasyAnimation.swift:446
    frame #4: 0x0000000101671dcc EasyAnimation`static ext.EasyAnimation.__ObjC.CALayer.initialize (self=CALayer)() -> () + 132 at EasyAnimation.swift:438
    frame #5: 0x0000000101671f54 EasyAnimation`@objc static ext.EasyAnimation.__ObjC.CALayer.initialize (__ObjC.CALayer.Type)() -> () + 24 at EasyAnimation.swift:0
    frame #6: 0x00000001998fcfc8 libobjc.A.dylib`_class_initialize + 800
    frame #7: 0x00000001999038f8 libobjc.A.dylib`lookUpImpOrForward + 184
    frame #8: 0x000000019990ddb8 libobjc.A.dylib`_objc_msgSend_uncached_impcache + 56
    frame #9: 0x00000001031b6338 GPUToolsCore`DYCALayerInterposeInit() + 108
    frame #10: 0x00000001011891f0 libglInterpose.dylib`DYGLInitPlatform + 56
    frame #11: 0x00000001031a421c GPUToolsCore`GPUTools::Interpose::DYInterposeCommonInit(bool (*)(DYTransport*)) + 464
    frame #12: 0x00000001031b292c GPUToolsCore`GPUTools::Interpose::DYInterposeThreadEntry(void*) + 16
    frame #13: 0x000000019a323b28 libsystem_pthread.dylib`_pthread_body + 156
    frame #14: 0x000000019a323a8c libsystem_pthread.dylib`_pthread_start + 156

It crashes here:

private static func replaceAnimationMethods() {
    //replace actionForKey
    method_exchangeImplementations(
->      class_getInstanceMethod(self, "actionForKey:"),
        class_getInstanceMethod(self, "EA_actionForKey:"))
}

It works perfectly on the simulator.

How could I chain animation from different code block?

I need chain the animation from different code block while I have a var of chain. But it didn't work after the chain finished, how could I do it?

var animationChain:EAAnimationDelayed = UIView.animateAndChainWithDuration...

func someFunction() {

    self.animationChain.animateWithDuration...
}

func anotherFunction() {

    self.animationChain.animateWithDuration...
}

Swift 3

Hey everyone,

I pulled the Swift 3 branch https://github.com/icanzilb/EasyAnimation/tree/swift3 that was build by PRs so far (thanks again!) and did a conversion to Swift 3 syntax coding session so now the EA methods are concise with the UIKit methods. The demo app works fine (after fixing few things that looks like UIKit bugs in beta 3) but I'd like to get more feedback from ppl if the swift 3 branch works fine in their own projects.

Note that I also added a EasyAnimation.disableSwizzling() for the ones who still want to use sequences but don't want to swizzle all methods (recurring topic in this repo).

Thanks, and looking forward to some feedback if you have

Doesn't ios8 already have this?

I've been working with the core iOS methods and the examples you gave in EasyAnimation is the same as standard iOS ones. Am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.