Comments (14)
Well "by definition" and "everyone thinks X" won't convince me. Further the link you gave me says "method swizzling is reasonably safe" under Considerations.
from easyanimation.
Hey Daniel, it's the first time I hear that swizzling is not safe :) Where did you read that 😀
from easyanimation.
You can read about it everywhere :-)
The thing is that you are changing behaviour of system apis - and you cannot know the effects of that over other mechanisms.
It's by definition unpredictable and should only be used when there's absolutely no other way.
It's common sense, but if you want a "source" other than me/common-sense, you could read about it here: http://nshipster.com/method-swizzling/, in the last section "considerations".
from easyanimation.
Are you ready to consider non-swizzling version - since the problems like #14 and other problems that I experienced during a 10 minutes play with the library - prove that swizzling is unpredictable as I said?
from easyanimation.
well - I'm open to suggestions of course :) what do you think we should change?
from easyanimation.
Well, right now you are replacing the native UIView animate...
function to supply a "zero configuration" setup.
What I would recommend is having a separate static function for animating, something like UIView easyAnimate...
or UIView coreAnimate
etc.
Then having a setup function that takes care of the swizzling, and and the user can call on "appDidLaunch".
The bigger problem, is with current users. They are used to the swizzling being the default- so having that as the default configuration will solve that, and having an "unswizzle" function.
That's the general idea- and I think that the most important thing is first to allow working with the library without swizzling so people who are experiencing bugs with OS animations will be able to void them, and then you have the time to improve the swizzling method to maybe take care of certain bugs.
But note that it's not a given that there's a fix for the swizzlng- as much of the behaviour is code you cannot see, and may change from version to version.
I thnk that eventually swizzling should be an opt-in feature, and that the docs should mention this being turned off by default since version X.Y.Z...
from easyanimation.
okay - I have already thought in that general direction as well. For me personally is more interesting to understand why do those animations break and if it is possible to avoid that happening.
Another idea that popped in my mind was to just include a new animation option you can add along with .Repeat, .Autoreverse, etc. called say .AnimateLayers that would enable the swizzled version for that particular animation.
I will have to think more what would be the leanest way to handle this
from easyanimation.
Oh yes - versioning is not a problem major version changes are okay to break so in case the bahavior drastically change, e.g. opt-in swizzle I'll just relase it as 2.0.0
from easyanimation.
Actually .AnimateLayers
sounds beautiful! The only problem is that it is still possible to break. On the upside it will reduce the chances of collisions drastically (As long as the flag will be drastically higher than the current highest flag value)
from easyanimation.
tbh apple has not introduced any new animation options since iOS2, I don't think it's gonna be a problem any soon
from easyanimation.
Well they did not - but they did generally add animation options, like spring etc. So it's not that the animation mechanism is not evolving.
Anyway now I'm looking at their animation options, and it looks like most of the space is already occupied:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/swift/struct/c:@E@UIViewAnimationOptions
It looks like something like 1 << 12
would be fine to use.
I really hope that the next evolutionary step would be Apple embracing this and adding to the UIView implementation. I mean, you've already done all the work...
from easyanimation.
I have already introduced a few, but haven't advertised them at all: https://github.com/icanzilb/EasyAnimation/blob/master/EasyAnimation/EasyAnimation.swift#L103
Thought I might get rid of them in favor of other more interesting options
from easyanimation.
Well you will always need to reserve space for at least the trigger for CA animations///
from easyanimation.
Adressed in https://github.com/icanzilb/EasyAnimation/releases/tag/2.0.0 Thanks!
from easyanimation.
Related Issues (20)
- Seems to crash in Xcode7.3 / iOS 9.3 HOT 2
- Animating properties of more than one elements HOT 2
- Animations going in reverse HOT 1
- Error after update to Xcode 7.3 HOT 3
- Swift 3 HOT 1
- How to use with Carthage? HOT 10
- v1.1 hasn't been added as a pod yet HOT 1
- EAAnimationDelayed.swift file missing in xcode HOT 2
- Question about "pending:" print statements HOT 5
- Spring Animation HOT 3
- Disable aggressive debug logging HOT 1
- Warnings: Method 'initialize()' defines Objective-C class method 'initialize', which is not guaranteed to be invoked by Swift and will be disallowed in future versions HOT 6
- String interpolation produces debug description HOT 2
- Co-maintainer needed
- 2.0.0 concerns HOT 7
- Animations in chain seam to get cached. Adding other animations to a view that is finished animating restars the whole chain. HOT 1
- Module compiled with Swift 4.0.3 cannot be imported in Swift 4.1 HOT 2
- EasyAnimation 2.2.1 issue HOT 3
- Objective c enable
- Use of unresolved identifier 'EAAnimationFuture'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easyanimation.