Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bawn/aquaman
A pure-Swift library for nested display of horizontal and vertical scrolling views
https://github.com/bawn/aquaman
menuview nestedscrollview page pageviewcontroller scrollview swift swift-framework swift-library vertical-scrolling-views
Last synced: 3 days ago
JSON representation
A pure-Swift library for nested display of horizontal and vertical scrolling views
- Host: GitHub
- URL: https://github.com/bawn/aquaman
- Owner: bawn
- License: mit
- Created: 2019-01-11T13:50:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-07-28T05:31:48.000Z (over 3 years ago)
- Last Synced: 2025-02-09T06:11:43.559Z (11 days ago)
- Topics: menuview, nestedscrollview, page, pageviewcontroller, scrollview, swift, swift-framework, swift-library, vertical-scrolling-views
- Language: Swift
- Homepage: https://bawn.github.io/#blog
- Size: 2.63 MB
- Stars: 270
- Watchers: 7
- Forks: 42
- Open Issues: 2
-
Metadata Files:
- Readme: README-EN.md
- License: LICENSE
Awesome Lists containing this project
README
# Aquaman



[](https://www.apple.com/nl/ios/)
[](https://developer.apple.com/swift/)A pure-Swift library for nested display of horizontal and vertical scrolling views.

## Requirements
- iOS 9.0+
- Swift 4.2+
- Xcode 10+## Installation
#### [CocoaPods](http://cocoapods.org/) (recommended)
```
use_frameworks!pod 'Aquaman'
```## Usage
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:
#### Create a AquamanPageViewController subclass
```swift
import Aquamanclass PageViewController: AquamanPageViewController {
// ...
}
```#### Provide the view controllers that will appear embedded into the AquamanPageViewController
```swift
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`
```swift
import Aquaman
class ChildViewController: UIViewController, AquamanChildViewController {@IBOutlet weak var tableView: UITableView!
func aquamanChildScrollView() -> UIScrollView {
return tableView
}
// ...
}
```#### Provide the headerView and headerView height
```swift
override func headerViewFor(_ pageController: AquamanPageViewController) -> UIView {
return HeaderView()
}override func headerViewHeightFor(_ pageController: AquamanPageViewController) -> CGFloat {
return headerViewHeight
}
```#### Provide the menuView and menuView height
```swift
override func menuViewFor(_ pageController: AquamanPageViewController) -> UIView {
return menuView
}override func menuViewHeightFor(_ pageController: AquamanPageViewController) -> CGFloat {
return menuViewHeight
}
```#### Update menuView's layout when content scroll view did scroll and check state when viewController did end isplay
```swift
override func pageController(_ pageController: AquamanPageViewController, contentScrollViewDidScroll scrollView: UIScrollView) {
menuView.updateLayout(scrollView)
}override func pageController(_ pageController: AquamanPageViewController, didDisplay viewController: (UIViewController & AquamanChildViewController), forItemAt index: Int) {
menuView.checkState(animation: true)
}
```## Examples
Follow these 4 steps to run Example project:
1. Clone Aquaman repository
2. Run the `pod install` command
3. Open Aquaman workspace
4. Run the Aquaman-Demo project.### License
Aquaman is released under the MIT license. See LICENSE for details.