A pure-Swift library for nested display of horizontal and vertical scrolling views.
- iOS 9.0+
- Swift 4.2+
- Xcode 10+
CocoaPods (recommended)
use_frameworks!
pod 'Aquaman'
First make sure to import the framework:
import Aquaman
Basically, we just need to provide the list of child view controllers to show. Then call some necessary methods.
Let's see the steps to do this:
import Aquaman
class PageViewController: AquamanPageViewController {
// ...
}
override func numberOfViewControllers(in pageController: AquamanPageViewController) -> Int {
return count
}
override func pageController(_ pageController: AquamanPageViewController, viewControllerAt index: Int) -> (UIViewController & AquamanChildViewController) {
// ...
return viewController
}
Every UIViewController that will appear within the AquamanPageViewController should conform to AquamanChildViewController
by implementing func aquamanChildScrollView() -> UIScrollView
import Aquaman
class ChildViewController: UIViewController, AquamanChildViewController {
@IBOutlet weak var tableView: UITableView!
func aquamanChildScrollView() -> UIScrollView {
return tableView
}
// ...
}
override func headerViewFor(_ pageController: AquamanPageViewController) -> UIView {
return HeaderView()
}
override func headerViewHeightFor(_ pageController: AquamanPageViewController) -> CGFloat {
return headerViewHeight
}
override func menuViewFor(_ pageController: AquamanPageViewController) -> UIView {
return menuView
}
override func menuViewHeightFor(_ pageController: AquamanPageViewController) -> CGFloat {
return menuViewHeight
}
override func pageController(_ pageController: AquamanPageViewController, contentScrollViewDidScroll scrollView: UIScrollView) {
menuView.updateLayout(scrollView)
}
override func pageController(_ pageController: AquamanPageViewController,
contentScrollViewDidEndScroll scrollView: UIScrollView) {
menuView.checkState()
}
Follow these 4 steps to run Example project:
- Clone Aquaman repository
- Run the
pod install
command - Open Aquaman workspace
- Run the Aquaman-Demo project.
Aquaman is released under the MIT license. See LICENSE for details.