Rightpoint / RZViewActions

A category on UIView that provides animation structure similar to SKAction from SpriteKit.
Other
103 stars 13 forks source link

Feature suggestion #11

Open gerchicov-bp opened 9 years ago

gerchicov-bp commented 9 years ago

I have 3 tasks 2 of them are asynchronous and the third one should be started after both previous ones are completed. I know I could create a group of 2 tasks and run the third as a completion after them.

The problem is the first task is animation but the second one is not (but it generates a visual result which will be used in the third task). Of course I can work with this non-animation task as with animation of duration 0 but is it correct/convenient? What about to add a possibility to add something like new RZViewAction type which will not call the animationWithDuration:... but is still can be placed into groups/sequences of RZViewActions library?

jvisenti commented 9 years ago

Hey @gerchicov-bp, there's no reason why not to simply create an action with your block and duration of 0. The UIView animation APIs specifically state that this is ok, and that your block will be just be called immediately without animation. If you want to delay the completion of the group even though no animation is happening, try adding a wait action via +[RZViewAction waitForDuration:]. Hope this helps.

gerchicov-bp commented 9 years ago

I forgot to mention the problem is when I perform animation I exactly know how much does it take. But what happens in case of non-animated task but with undefined time of execution?

jvisenti commented 9 years ago

I suppose you could use a serial dispatch queue or perhaps a dispatch_semaphore to solve your issue. There is currently no way built in to this library to synchronize animations with non-animated work.