# Conflicts: # CHANGELOG.md # LeadKit.podspec # TIAppleMapUtils/TIAppleMapUtils.podspec # TIAuth/TIAuth.podspec # TIEcommerce/TIEcommerce.podspec # TIFoundationUtils/TIFoundationUtils.podspec # TIGoogleMapUtils/TIGoogleMapUtils.podspec # TIKeychainUtils/TIKeychainUtils.podspec # TILogging/TILogging.podspec # TIMapUtils/TIMapUtils.podspec # TIMoyaNetworking/TIMoyaNetworking.podspec # TINetworking/TINetworking.podspec # TINetworkingCache/TINetworkingCache.podspec # TIPagination/TIPagination.podspec # TISwiftUICore/TISwiftUICore.podspec # TISwiftUtils/TISwiftUtils.podspec # TITableKitUtils/TITableKitUtils.podspec # TITransitions/TITransitions.podspec # TIUIElements/TIUIElements.podspec # TIUIKitCore/TIUIKitCore.podspec # TIYandexMapUtils/TIYandexMapUtils.podspec |
||
|---|---|---|
| .. | ||
| Assets | ||
| Sources | ||
| README.md | ||
| TIUIElements.podspec | ||
README.md
TIUIElements
Bunch of useful protocols and views:
RefreshControl- a basic UIRefreshControl with fixed refresh action.
HeaderTransitionDelegate
Use for transition table header to navigationBar view while scrolling
Your class must implement CollapsibleViewsContainer protocol
HeaderViewHandlerProtocol
public protocol CollapsibleViewsContainer {
var topHeaderView: UIView? { get } // titleView
var bottomHeaderView: UIView? { get } // tableHeaderView
var fixedTopOffet: CGFloat { get } // status bar + nav bar height
}
UIViewController have default realization for fixedTopOffet.
TransitioningHandler
TransitioningHandler Binds animators to the container.
public protocol TransitioningHandler: UIScrollViewDelegate {
var animator: CollapsibleViewsAnimator? { get set }
init(collapsibleViewsContainer: CollapsibleViewsContainer)
}
Customization
You can use both the various types of animation already implemented to change the view, or create your own. To create an animator, you need to implement the CollapsibleViewsAnimator protocol.
public protocol CollapsibleViewsAnimator {
var fractionComplete: CGFloat { get set } // progress of animation
var currentContentOffset: CGPoint { get set } // offset on content in table view/collection view or plain scroll view
}
Already implemented animators
ParalaxAnimator- applies only parallax effect to the header of tableParalaxWithTransitionAnimator- applies parallax effect to the header of table with transition effect down up of the navigationBar titleViewTransitionAnimator- applies only transition effect down up of the navigationBar titleViewScaleAnimator- applies only scale effect down up of the navigationBar titleViewParalaxWithScaleAnimator- applies parallax effect to the header of table with scale effect down up of the navigationBar titleViewnil(default value) - dont applies any effects
TableViewHeaderTransitioningHandler is the default implementation for TransitioningHandler. It creates an animation action when scrolling the table.
Usage default realization with tableView
class ViewController: UITableViewController, CollapsibleViewsContainer {
private lazy var handler = TableViewHeaderTransitioningHandler(collapsibleViewsContainer: self)
private lazy var parallaxTableHeaderView = ParallaxTableHeaderView(wrappedView: bottomHeaderView ?? UIView())
var topHeaderView = SomeCustomTopView()
var bottomHeaderView = SomeCustomBottomView()
func addViews() {
tableView.tableHeaderView = parallaxTableHeaderView
navigationController?.navigationBar.topItem?.titleView = topHeaderView
}
func bindViews() {
handler.animator = ParalaxWithTransitionAnimator(tableHeaderView: parallaxTableHeaderView,
navBar: navigationController?.navigationBar,
currentContentOffset: tableView.contentOffset)
tableView.delegate = self
tableView.dataSource = self
}
override func scrollViewDidScroll(_ scrollView: UIScrollView) {
handler.scrollViewDidScroll(scrollView)
}
}
Examples
none
|
|
|
onlyParalax
paralaxWithTransition
transition
scale
paralaxWithScale
Installation via SPM
You can install this framework as a target of LeadKit.