fix: pr issue

This commit is contained in:
Boyko Mihail 2021-06-18 11:09:59 +03:00
parent e38ee51275
commit a9c7bd6abd
4 changed files with 26 additions and 7 deletions

View File

@ -16,7 +16,7 @@ public protocol CollapsibleViewsContainer: class, TableViewHandler {
var bottomHeaderView: UIView? { get } // tableHeaderView
var fixedTopOffet: CGFloat { get } // status bar + nav bar height
var navigationBar: UINavigationBar? { get }
var navBar: UINavigationBar? { get }
var tableView: UITableView { get }
}
@ -30,6 +30,13 @@ var fixedTopOffet: CGFloat {
}
```
UIViewController have default realization for navBar
```swift
public var navBar: UINavigationBar? {
navigationController?.navigationBar
}
```
## Usage if your ViewController don't needs extend UITableViewDelegate
```swift
let headerTransitionDelegate = HeaderTransitionDelegate(headerViewHandler: self)

View File

@ -16,10 +16,10 @@ open class HeaderTransitionDelegate: NSObject, UIScrollViewDelegate {
private var titleView: UIView? {
get {
headerViewHandler?.navigationBar?.topItem?.titleView
headerViewHandler?.navBar?.topItem?.titleView
}
set {
headerViewHandler?.navigationBar?.topItem?.titleView = newValue
headerViewHandler?.navBar?.topItem?.titleView = newValue
}
}
@ -103,7 +103,7 @@ open class HeaderTransitionDelegate: NSObject, UIScrollViewDelegate {
}
private func animate(headerAnimation: HeaderAnimationType, alpha: CGFloat) {
debugPrint("titleView = ", headerViewHandler?.navBar)
switch headerAnimation {
case .paralaxWithTransition:
titleView?.transition(to: alpha)

View File

@ -0,0 +1,11 @@
import UIKit
public protocol NavigationBarHandler {
var navBar: UINavigationBar? { get }
}
extension UIViewController: NavigationBarHandler {
public var navBar: UINavigationBar? {
navigationController?.navigationBar
}
}

View File

@ -1,11 +1,12 @@
import UIKit
public protocol CollapsibleViewsContainer: class, TableViewHandler {
public protocol CollapsibleViewsContainer: class,
TableViewHandler,
NavigationBarHandler {
var topHeaderView: UIView? { get } // titleView
var bottomHeaderView: UIView? { get } // tableHeaderView
var fixedTopOffet: CGFloat { get } // status bar + nav bar height
var navigationBar: UINavigationBar? { get }
}
public extension UIViewController {