removed old code added tabSpace readonly
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
bf63fe9e61
commit
fb8ccd6d10
@ -61,7 +61,8 @@ open class Tabs: View {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
///An optional callback that is called when the selectedIndex changes. Passes parameters (event, tabIndex).
|
///An
|
||||||
|
/// callback that is called when the selectedIndex changes. Passes parameters (event, tabIndex).
|
||||||
open var onTabChange: ((Int) -> Void)?
|
open var onTabChange: ((Int) -> Void)?
|
||||||
|
|
||||||
//Determines the layout of the Tabs, defaults to horizontal
|
//Determines the layout of the Tabs, defaults to horizontal
|
||||||
@ -97,36 +98,8 @@ open class Tabs: View {
|
|||||||
///Model of the Tabs you are wanting to show.
|
///Model of the Tabs you are wanting to show.
|
||||||
open var tabModels: [TabModel] = [] { didSet { updateTabItems() } }
|
open var tabModels: [TabModel] = [] { didSet { updateTabItems() } }
|
||||||
|
|
||||||
// //rules for width
|
open var tabSpacing: CGFloat { tabStackView.spacing }
|
||||||
// private var _width: Width? = .percentage(0.25)
|
|
||||||
//
|
|
||||||
// ///Width of all Tabs when orientation is vertical, defaults to 25%.
|
|
||||||
// open var width: Width? {
|
|
||||||
// get {
|
|
||||||
// return _width
|
|
||||||
// }
|
|
||||||
// set {
|
|
||||||
// if let newValue {
|
|
||||||
// switch newValue {
|
|
||||||
// case .percentage(let percentage):
|
|
||||||
// if percentage >= 0 && percentage <= 1 {
|
|
||||||
// _width = newValue
|
|
||||||
// setNeedsUpdate()
|
|
||||||
// } else {
|
|
||||||
// print("Invalid percentage value. It should be between 0 and 1.")
|
|
||||||
// }
|
|
||||||
// case .value(let value):
|
|
||||||
// if value >= minWidth {
|
|
||||||
// _width = newValue
|
|
||||||
// setNeedsUpdate()
|
|
||||||
// } else {
|
|
||||||
// print("Invalid value. It should be greater than or equal to \(minWidth).")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
open var tabItems: [TabItem] = []
|
open var tabItems: [TabItem] = []
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -252,12 +225,6 @@ open class Tabs: View {
|
|||||||
// Apply width
|
// Apply width
|
||||||
if orientation == .vertical {
|
if orientation == .vertical {
|
||||||
scrollView.isScrollEnabled = false
|
scrollView.isScrollEnabled = false
|
||||||
// switch width {
|
|
||||||
// case .percentage(let amount):
|
|
||||||
// contentViewWidthConstraint = contentView.widthAnchor.constraint(equalTo: widthAnchor, multiplier: amount)
|
|
||||||
// case .value(let amount):
|
|
||||||
// contentViewWidthConstraint = contentView.widthAnchor.constraint(equalToConstant: amount)
|
|
||||||
// }
|
|
||||||
contentViewWidthConstraint = contentView.widthAnchor.constraint(equalTo: widthAnchor)
|
contentViewWidthConstraint = contentView.widthAnchor.constraint(equalTo: widthAnchor)
|
||||||
} else {
|
} else {
|
||||||
// Apply overflow
|
// Apply overflow
|
||||||
@ -309,21 +276,4 @@ open class Tabs: View {
|
|||||||
|
|
||||||
scrollToSelectedIndex(animated: true)
|
scrollToSelectedIndex(animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// //--------------------------------------------------
|
|
||||||
// // MARK: - Private Methods
|
|
||||||
// //--------------------------------------------------
|
|
||||||
// private func tabWidth(for item: TabItem) -> CGFloat? {
|
|
||||||
// guard orientation == .vertical else { return item.width }
|
|
||||||
// var calculated: CGFloat
|
|
||||||
// switch width {
|
|
||||||
// case .percentage(let percent):
|
|
||||||
// calculated = (bounds.width * percent) - tabStackView.spacing
|
|
||||||
// case .value(let value):
|
|
||||||
// calculated = value - tabStackView.spacing
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return calculated > minWidth ? calculated : minWidth
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user