removed old code added tabSpace readonly

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-05-25 07:58:25 -05:00
parent bf63fe9e61
commit fb8ccd6d10

View File

@ -61,7 +61,8 @@ open class Tabs: View {
//--------------------------------------------------
// 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)?
//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.
open var tabModels: [TabModel] = [] { didSet { updateTabItems() } }
// //rules for width
// 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 tabSpacing: CGFloat { tabStackView.spacing }
open var tabItems: [TabItem] = []
//--------------------------------------------------
@ -252,12 +225,6 @@ open class Tabs: View {
// Apply width
if orientation == .vertical {
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)
} else {
// Apply overflow
@ -309,21 +276,4 @@ open class Tabs: View {
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
// }
}