Swiftpack.co -  nicnocquee/header-sticky-tab as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
nicnocquee/header-sticky-tab
A container view controller that displays children view controllers in tabs like the profile screen on Twitter or Instagram without any dependencies
.package(url: "https://github.com/nicnocquee/header-sticky-tab.git", from: "0.0.3")

HeaderStickyTabViewController

About

A container view controller that displays children view controllers in tabs like the profile screen on Twitter or Instagram without any dependencies. When the user scrolls the scroll view of the child view controller, the tab/segment control stick at the top.

Features

  • Custom header view
  • Custom tab view

Installation

Manual

Add the HeaderStickyTabViewController.swift file from Sources/HeaderStickyTabViewController directory to your project.

Swift Package Manager

Add this package in Xcode: https://github.com/nicnocquee/header-sticky-tab

Cocoapods

Coming soon.

Usage

  • Create a view controller that extends HeaderStickyTabViewController
  • Assign a view to headerView property.
  • Assign the children view controllers to viewControllers property.
  • Override childDidScroll function if needed.
  • Override didChangePage method if needed.
import HeaderStickyTabViewController

class ProfileViewController: HeaderStickyTabViewController {

    static func create() -> ProfileViewController {
        let vc = ProfileViewController()
        vc.title = "Child"

        vc.headerView = ProfileHeaderView()
        vc.viewControllers = [
            FirstTabViewController(style: .plain),
            SecondTabViewController(style: .plain)
        ]

        return vc
    }
}

Checkout Example/HeaderStickyTab/ProfileViewController.swift in this repository for example.

Example

Open Example/HeaderStickyTab.xcworkspace. Run the sample app in simulator. The example shows how to blur the header image when user pull down the scroll view.

License

MIT

GitHub

link
Stars: 3
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API