refactored enums

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-01-13 09:59:07 -06:00
parent 25144ae1bc
commit 84406b1e63
2 changed files with 10 additions and 7 deletions

View File

@ -13,9 +13,16 @@ import Combine
@objc(VDSButtonGroup) @objc(VDSButtonGroup)
open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, ButtongGroupPositionLayoutDelegate { open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, ButtongGroupPositionLayoutDelegate {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
public enum ButtonPosition: String, CaseIterable {
case left, center, right
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
//An object containing number of Button components per row, in each viewport //An object containing number of Button components per row, in each viewport
open var rowQuantityPhone: Int = 0 { didSet { didChange() } } open var rowQuantityPhone: Int = 0 { didSet { didChange() } }

View File

@ -47,7 +47,7 @@ class ButtonCollectionViewRow {
} }
} }
func layout(for position: ButtonPosition, with collectionViewWidth: CGFloat){ func layout(for position: ButtonGroup.ButtonPosition, with collectionViewWidth: CGFloat){
var offset = 0.0 var offset = 0.0
let height = rowHeight let height = rowHeight
attributes.last?.spacing = 0 attributes.last?.spacing = 0
@ -120,10 +120,6 @@ class ButtonCollectionViewRow {
} }
} }
public enum ButtonPosition: String, CaseIterable {
case left, center, right
}
protocol ButtongGroupPositionLayoutDelegate: AnyObject { protocol ButtongGroupPositionLayoutDelegate: AnyObject {
func collectionView(_ collectionView: UICollectionView, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize func collectionView(_ collectionView: UICollectionView, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize
func collectionView(_ collectionView: UICollectionView, buttonableAtIndexPath indexPath: IndexPath) -> any Buttonable func collectionView(_ collectionView: UICollectionView, buttonableAtIndexPath indexPath: IndexPath) -> any Buttonable
@ -154,7 +150,7 @@ class ButtonGroupPositionLayout: UICollectionViewLayout {
// Total height of the content. Will be used to configure the scrollview content // Total height of the content. Will be used to configure the scrollview content
var layoutHeight: CGFloat = 0.0 var layoutHeight: CGFloat = 0.0
var position: ButtonPosition = .left var position: ButtonGroup.ButtonPosition = .left
var rowQuantity: Int = 0 var rowQuantity: Int = 0
var buttonPercentage: CGFloat? var buttonPercentage: CGFloat?