I created this project to demonstrate the power of child view controllers in iOS development. But in order to avoid boring and simple interfaces in this concept, I was using interactive views and custom transitions 😎 Please check attached video below, demonstrating how it works.
- This project contains only pure Swift❤️
- No third-party frameworks and Pods.
I wrote an article on Medium about child view controllers. You can find some code explanations from this project in that article too.
Here is a shot on Dribbble.
UIPanGestureRecognizer
for dragging cards.CADisplayLink
for accurate observing of frames changes in animations.UIView.animate{}
blocks for most of the animations.CABasicAnimation
for shadow layer.UIViewControllerTransitioningDelegate
for custom transition to Details scene.- All UI is made programmatically, thus it’s reusable. No xibs, no storyboards.
Here is a structure of main screen.
ProfileViewController - as a parent view controller, subclassed from CardsHolderViewController
. It contains such child view controllers:
- ProfileShortInfoViewController (top part of the screen)
- ProfileActivityViewController (activity card)
- RecommendationsViewController (recommended card)
If you open recommended card, there will be such state for the screen:
Fully visible RecommendationsViewController, that contains tableView with cells, each of which holds child view controller subclassed from RecommendationsSliderViewController
.
If you have any questions or suggestions, feel free to open issue just at this project.
CardsHolder and all its classes are available under the MIT license. See the LICENSE file for more info.