CaseContainer 0.9.3

CaseContainer 0.9.3

Maintained by mjun.



  • By
  • Minjun Ju

CaseContainer

Swift Build Status pod compatible Carthage compatible codecov

full withTabBar

CaseContainer is Container View Controller

Requirements

CaseContainer requires iOS 9 or above and is written in Swift 4.2

Installation

CocoaPods

CaseContainer is available through CocoaPods. To install it, simply add the following line to your podfile:

pod 'CaseContainer', '~> 0.9.0'

And run pod install.

Carthage

CaseContainer is available through Carthage. Simply install carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

add CaseContainer to your Cartfile:

github "devmjun/CaseContainer" ~> 0.9.0

And run carthage update.

Usage

  1. Create an instance of a ParallaxTableViewController, ParallaxCollectionViewController or YourSomeViewController
import CaseContainer

// 1
class YourChildTableViewController: ParallaxTableViewController {
}

class YourChildTableViewController: ParallaxCollectionViewController {
}

// or 1
class YourSomeViewController: UIViewController {
}
  1. Create an instance of a CaseContainerViewController and provide it with a ParallaxTableViewDelegate if you use ParallaxTableViewController
  2. and then provide Appearance to appearance
// 2
class YourContainerViewController: CaseContainerViewController {
    required init() {
        super.init()
        let tableViewController = YourChildTableViewController()
        tableViewController.title = "My Table View Controller"
        tableViewController.delegate = self
        
        let someViewController = YourSomeViewController()
        someViewController.title = "My Some View Controller"
        
        // 3
        appearance = Appearance(
            headerViewHegiht: 150,
            tabScrollViewHeight: 50,
            indicatorColor: .green,
            tabButtonColor: (normal: .gray, highLight: .black))
        
        // 4
        viewContorllers = [tableViewController, someViewController]
    }
}

Delegation

scrollViewWillBeginDragging

Tells the delegate when the Container scroll view is about to start scrolling the content.

func caseContainer(
    caseContainerViewController: CaseContainerViewController,
    scrollViewWillBeginDragging scrollView: UIScrollView)

scrollViewDidScroll

Tells the delegate when the user scrolls the Container content view within the receiver.

func caseContainer(
    caseContainerViewController: CaseContainerViewController,
    progress: CGFloat,
    index: Int,
    scrollViewDidScroll scrollView: UIScrollView)

scrollViewDidEndDragging

Tells the delegate when dragging ended in the Container scroll view.

func caseContainer(
    caseContainerViewController: CaseContainerViewController,
    index: Int,
    scrollViewDidEndDragging scrollView: UIScrollView)

scrollViewDidEndDecelerating

Tells the delegate that the Container scroll view has ended decelerating the scrolling movement

func caseContainer(
    caseContainerViewController: CaseContainerViewController,
    index: Int,
    scrollViewDidEndDecelerating scrollView: UIScrollView)

didSelectTabButton

Tells the delegate when tabButton is clicked

func caseContainer(
    caseContainerViewController: CaseContainerViewController,
    didSelectTabButton tabButton: TabButton,
    prevIndex: Int,
    index: Int)

parallaxHeader

Tells the delegate When the header view is covered by the container scroll view

func caseContainer(parallaxHeader progress: CGFloat)

Contributing

Bug reports, pull request and any discussion are welcome

License

CaseContainer is available as open source under the terms of the MIT License