Latest 0.0.2
Homepage https://github.com/bawn/Aquaman
License MIT
Platforms ios 9.0, requires ARC
Authors

License MIT
Pod version
Platform info
Support
Swift 4.2

A pure-Swift library for nested display of horizontal and vertical scrolling views.

demo

Requirements

  • iOS 9.0+
  • Swift 4.2+
  • Xcode 10+

Installation

CocoaPods (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

import Aquaman

class PageViewController: AquamanPageViewController {
  // ...
}

Provide the view controllers that will appear embedded into the 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
    }
    // ...
}

Provide the headerView and headerView height

override func headerViewFor(_ pageController: AquamanPageViewController) -> UIView {
    return HeaderView()
}

override func headerViewHeightFor(_ pageController: AquamanPageViewController) -> CGFloat {
    return headerViewHeight
}

Provide the menuView and menuView height

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 did end scoll

override func pageController(_ pageController: AquamanPageViewController, contentScrollViewDidScroll scrollView: UIScrollView) {
    menuView.updateLayout(scrollView)
}

override func pageController(_ pageController: AquamanPageViewController,
                             contentScrollViewDidEndScroll scrollView: UIScrollView) {
    menuView.checkState()
}

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.

Latest podspec

{
    "name": "Aquaman",
    "version": "0.0.2",
    "summary": "u57fau4e8eAFNetworkingu7684u7f51u7edcu5e93u5c01u88c5",
    "homepage": "https://github.com/bawn/Aquaman",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "bawn": "[email protected]"
    },
    "swift_version": "4.2",
    "source": {
        "git": "https://github.com/bawn/Aquaman.git",
        "tag": "0.0.2"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": "Aquaman/Aquaman/*.swift"
}

Pin It on Pinterest

Share This