

Those were ancient times and I needed to support devices since iOS 8 😯😯😯 That's why many of UIKit Dynamics features were simply not available. Replaces the background image of the overlay view with the snapshot of the whole screen, creating effect of a trailing tail of cards.Makes snapshots continuously of the whole screen by timer (simple timer or via display link timer, depending on desired frequency).Animates the fall and jump of the cards, using UIKit Dynamic physics engine.It's also done as an overlay on the game field view. When animation is finished, viewController receives callback, target collection view is reloaded.Animations controller simply moves snapshots from one place to another.Source collection view is reloaded (source collection view is synced with game state now and it is actually empty).Animations controller makes snapshots of the required cells of source collection view according to actions.Autocomplete game actions are generated and applied to the the game state without touching UI (game state becomes out of sync with UI).When animation is finished, viewController receives callback and corresponding cell is reloaded as visible and with flip animation if needed.Īlmost the same thing as initial game layout.Already knowing each card cell frame, animations controller simply adds an imageView with a card facedown image and moves it from one place to another.Collection view is reloaded with invisible cells.Just make snapshot of cell and move image view. It doesn't even know, that collection view is somehow related to gambling. All without changing the collection view itself. It makes snapshots of needed cells and performs all animations just with images placed as subviews on top of main game view. I've got an animations controller, that overlays game field. It looks like we populate the game collection view with cards. Fast cards move animation Game start cards layout animation That's way the move and the flip happen almost simultaneously. If we marked the item with setNeedsFlipAtIndexPath, it would flip at reload. performBatchUpdates(.) of the collection view (basically, move item from one section to another)Ĭollection view's batch animated updates always trigger cellForItemAtIndexPath method call and reload the cell during the animation.Works exactly the same with the only difference: we perform the flip during applying animated changes to the collection view. Here we change facedown image with snapshot of card views or vice versa.Īfter all it creates a cool illusion of flipping cards. Use ansition(.) with flip animation parameter to simply animate the change of the UIImageView's image.Make snapshot of "data" view into an image.When we need to perform flip animation of the card we Card overlay imageView on top of the "data" view.Card "data" related views (number label, suit image, etc.).Face down image: the back side of the card that is simply an image asset.

In-place flip is usually applied when card changes its state from face down to face up. It's important to mention that flip flag is applied once and removed on cell reload. Flip cards animationsįlip animation starts with a method "setNeedsFlipAtIndexPath", that allows to mark cards that will be flipped on next cells reload. I've started to forget was going on there actually. That's why I decided just to share ideas overview of how animations were implemented.īTW it's been more than 2,5 years since I worked on that stuff. So the only way to show some samples is to share the whole project, that I unfortunately cannot afford. And all this won't work without game presenter. Those animations are useless without the overall screen view with collections views on it and their cards layout.
#STORYBOARD QUICK GAME CONTROLLER CODE#
Initially I was having an idea to provide an in-depth description with code examples and sample project.
