Commit 82564ad0 by Daniel Dahan

development: renamed Display properties with their respective type values as prefixes to Display

parent 0d4477a7
......@@ -71,7 +71,7 @@ open class CaptureController: ToolbarController {
*/
open override func prepare() {
super.prepare()
display = .full
toolbarDisplay = .full
view.backgroundColor = .black
prepareStatusBar()
......
......@@ -67,8 +67,10 @@ open class CollectionViewCard: Card {
open override func reload() {
if 0 == collectionView.height {
var h: CGFloat = 0
var i: Int = 0
for dataSourceItem in dataSourceItems {
h += dataSourceItem.height ?? 0
h += dataSourceItem.height ?? (dataSourceItems[i].data as? Card)?.height ?? 0
i += 1
}
collectionView.height = h
}
......@@ -94,13 +96,7 @@ extension CollectionViewCard {
}
}
extension CollectionViewCard: CollectionViewDelegate {
open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
// guard let card = dataSourceItemsIndexPaths[indexPath] as? Card else {
// return
// }
}
}
extension CollectionViewCard: CollectionViewDelegate {}
extension CollectionViewCard: CollectionViewDataSource {
@objc
......
......@@ -54,7 +54,7 @@ open class SearchBarController: StatusBarController {
display the rootViewController to the full view
bounds, or up to the searchBar height.
*/
open var display = Display.partial {
open var searchBarDisplay = Display.partial {
didSet {
layoutSubviews()
}
......@@ -68,15 +68,15 @@ open class SearchBarController: StatusBarController {
super.layoutSubviews()
let y = Application.shouldStatusBarBeHidden || statusBar.isHidden ? 0 : statusBar.height
let p = y + searchBar.height
searchBar.y = y
searchBar.width = view.width
switch display {
switch searchBarDisplay {
case .partial:
rootViewController.view.y = p
rootViewController.view.height = view.height - p
let h = y + searchBar.height
rootViewController.view.y = h
rootViewController.view.height = view.height - h
case .full:
rootViewController.view.frame = view.bounds
}
......
......@@ -49,6 +49,17 @@ extension UIViewController {
}
open class StatusBarController: RootController {
/**
A Display value to indicate whether or not to
display the rootViewController to the full view
bounds, or up to the toolbar height.
*/
open var statusBarDisplay = Display.full {
didSet {
layoutSubviews()
}
}
/// Device status bar style.
open var statusBarStyle: UIStatusBarStyle {
get {
......@@ -88,8 +99,16 @@ open class StatusBarController: RootController {
}
statusBar.width = view.width
switch statusBarDisplay {
case .partial:
let h = statusBar.height
rootViewController.view.y = h
rootViewController.view.height = view.height - h
case .full:
rootViewController.view.frame = view.bounds
}
}
/**
Prepares the view instance when intialized. When subclassing,
......
......@@ -74,7 +74,7 @@ open class ToolbarController: StatusBarController {
display the rootViewController to the full view
bounds, or up to the toolbar height.
*/
open var display = Display.partial {
open var toolbarDisplay = Display.partial {
didSet {
layoutSubviews()
}
......@@ -182,15 +182,15 @@ open class ToolbarController: StatusBarController {
super.layoutSubviews()
let y = Application.shouldStatusBarBeHidden || statusBar.isHidden ? 0 : statusBar.height
let p = y + toolbar.height
toolbar.y = y
toolbar.width = view.width
switch display {
switch toolbarDisplay {
case .partial:
rootViewController.view.y = p
rootViewController.view.height = view.height - p
let h = y + toolbar.height
rootViewController.view.y = h
rootViewController.view.height = view.height - h
case .full:
rootViewController.view.frame = view.bounds
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment