HoverConversion
  • October 6, 2023

ManiacDev.com referred.
https://maniacdev.com/2016/09/hoverconversion-a-swift-ui-component-for-navigating-between-multiple-table-views

 

HoverConversion realized vertical paging with UITableView. UIViewController will be paging when reaching top or bottom of UITableView’s contentOffset.

Features


  •  Vertical paging with UITableView
  •  Seamless transitioning
  •  Transitioning with navigationView pan gesture
  •  Selected cell that related to UIViewController is highlighting
  •  Support Swift2.3
  •  Support Swift3

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation


HoverConversion is available through CocoaPods. To install it, simply add the following line to your Podfile

pod “HoverConversion”

Usage


If you install from cocoapods, You have to write import HoverConversion.

Storyboard or Xib

Set custom class of UINavigationController to HCNavigationController. In addition, set module to HoverConversion. And set HCRootViewController as navigationController‘s first viewController.

Code

Set HCNavigationController as self.window.rootViewController. And set HCRootViewController as navigationController‘s first viewController.

HCPagingViewController

If you want to show vertical contents, please use HCPagingViewController.

let vc = HCPagingViewController(indexPath: indexPath)
vc.dataSource = self
navigationController?.pushViewController(vc, animated: true)

HCContentViewController

A content included in HCPagingViewController is HCContentViewController.
Return HCContentViewController (or subclass) with this delegate method.

extension ViewController: HCPagingViewControllerDataSource {
func pagingViewController(viewController: HCPagingViewController, viewControllerFor indexPath: NSIndexPath) -> HCContentViewController? {
guard 0 <= indexPath.row && indexPath.row < twitterManager.users.count else { return nil }
let vc = UserTimelineViewController()
vc.user = twitterManager.users[indexPath.row]
return vc
}
}

HCNextHeaderView

Return HCNextHeaderView (or subclass) with this delegate method.

 

extension ViewController: HCPagingViewControllerDataSource {
func pagingViewController(viewController: HCPagingViewController, nextHeaderViewFor indexPath: NSIndexPath) -> HCNextHeaderView? {
guard 0 <= indexPath.row && indexPath.row < twitterManager.users.count else { return nil }
let view = NextHeaderView()
view.user = twitterManager.users[indexPath.row]
return view
}
}

Stop transitioning

If you want to load more contents from server and want to stop transitioning, you can use canPaging in HCContentViewController.

//Stop transitioning to previous ViewController
canPaging[.prev] = false //Default true

//Stop transitioning to next ViewController
canPaging[.next] = false //Default true

Requirements


  • Xcode 7.3 or greater
  • iOS 8.0 or greater
  • MisterFusion – Swift DSL for AutoLayout

GitHub


View Github

#ios #pages #swift #uicomponents #uitableview
YOU MIGHT ALSO LIKE...
exyte

     

camerakit-ios

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service ...

HybridCamera

[video width="192" height="416" mp4="https://swiftgit.com/wp-content/uploads/2024/12/68747470733a2f2f7261776769742e636f6d2f7374796c656b69742f696d672f6d61737465722f7669645f6564697465645f325f326d622e676966.mp4"][/video]

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front ...

iOS-Depth-Sampler

Code examples of Depth APIs in iOS