CardsHolder
CardsHolder copied to clipboard
Demonstration of complex interface layouts using child view controllers in iOS 🦾
Sense
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.
Presentation
Key things:
UIPanGestureRecognizerfor dragging cards.CADisplayLinkfor accurate observing of frames changes in animations.UIView.animate{}blocks for most of the animations.CABasicAnimationfor shadow layer.UIViewControllerTransitioningDelegatefor custom transition to Details scene.- All UI is made programmatically, thus it’s reusable. No xibs, no storyboards.
Structure of the screen
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.
Feedback
If you have any questions or suggestions, feel free to open issue just at this project.
License
CardsHolder and all its classes are available under the MIT license. See the LICENSE file for more info.