added device ipad
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
be7d68636a
commit
e484d95d81
@ -14,7 +14,8 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
var collectionView: UICollectionView!
|
var collectionView: UICollectionView!
|
||||||
|
|
||||||
public enum RowQuantity: String, CaseIterable {
|
public enum RowQuantity: String, CaseIterable {
|
||||||
case one, two, three, four
|
case one, two, three
|
||||||
|
case four, five, six
|
||||||
|
|
||||||
init(quantity: Int){
|
init(quantity: Int){
|
||||||
if quantity == 1 {
|
if quantity == 1 {
|
||||||
@ -23,8 +24,14 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
self = .two
|
self = .two
|
||||||
} else if quantity == 3 {
|
} else if quantity == 3 {
|
||||||
self = .three
|
self = .three
|
||||||
} else {
|
} else if quantity == 4 {
|
||||||
self = .four
|
self = .four
|
||||||
|
} else if quantity == 5 {
|
||||||
|
self = .five
|
||||||
|
} else if quantity == 6 {
|
||||||
|
self = .six
|
||||||
|
} else {
|
||||||
|
self = UIDevice.isIPad ? .six : .three
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var intValue: Int {
|
var intValue: Int {
|
||||||
@ -37,18 +44,31 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
return 3
|
return 3
|
||||||
case .four:
|
case .four:
|
||||||
return 4
|
return 4
|
||||||
|
case .five:
|
||||||
|
return 5
|
||||||
|
case .six:
|
||||||
|
return 6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static var allCases: [TileletGroupViewController.RowQuantity] {
|
||||||
|
UIDevice.isIPad ? Self.allCases : [.one, .two, .three]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy var rowQuantitySelectorView = {
|
lazy var rowQuantitySelectorView = {
|
||||||
PickerSelectorView<RowQuantity>(title: "",
|
PickerSelectorView<RowQuantity>(title: "",
|
||||||
picker: self.picker,
|
picker: self.picker,
|
||||||
items: RowQuantity.allCases)
|
items: RowQuantity.allCases)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
lazy var paddingSelectorView = {
|
||||||
|
PickerSelectorView<TileletGroup.Padding>(title: "",
|
||||||
|
picker: self.picker,
|
||||||
|
items: TileletGroup.Padding.allCases)
|
||||||
|
}()
|
||||||
|
|
||||||
var disabledSwitch = Toggle()
|
var disabledSwitch = Toggle()
|
||||||
var widthTextField = NumericField()
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
@ -77,20 +97,15 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
addActionRow()
|
addActionRow()
|
||||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||||
addFormRow(label: "Disabled", view: disabledSwitch, pinTrailing: false)
|
addFormRow(label: "Disabled", view: disabledSwitch, pinTrailing: false)
|
||||||
addFormRow(label: "Width", view: widthTextField)
|
if UIDevice.isIPad {
|
||||||
|
addFormRow(label: "Padding", view: paddingSelectorView)
|
||||||
|
}
|
||||||
addFormRow(label: "Row Quantity", view: rowQuantitySelectorView)
|
addFormRow(label: "Row Quantity", view: rowQuantitySelectorView)
|
||||||
|
|
||||||
disabledSwitch.onChange = { [weak self] sender in
|
disabledSwitch.onChange = { [weak self] sender in
|
||||||
self?.component.isEnabled = !sender.isOn
|
self?.component.isEnabled = !sender.isOn
|
||||||
}
|
}
|
||||||
|
|
||||||
// widthTextField
|
|
||||||
// .numberPublisher
|
|
||||||
// .sink { [weak self] number in
|
|
||||||
// if let number {
|
|
||||||
// // self?.component.childWidth = .value(number.cgFloatValue)
|
|
||||||
// }
|
|
||||||
// }.store(in: &subscribers)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupModel() {
|
func setupModel() {
|
||||||
@ -98,7 +113,6 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
surfacePickerSelectorView.text = component.surface.rawValue
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
disabledSwitch.isOn = !component.isEnabled
|
disabledSwitch.isOn = !component.isEnabled
|
||||||
rowQuantitySelectorView.text = RowQuantity(quantity: component.rowQuantity).rawValue
|
rowQuantitySelectorView.text = RowQuantity(quantity: component.rowQuantity).rawValue
|
||||||
widthTextField.text = ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupPicker(){
|
func setupPicker(){
|
||||||
@ -108,9 +122,11 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
self?.contentTopView.backgroundColor = item.color
|
self?.contentTopView.backgroundColor = item.color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paddingSelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
|
self?.component.padding = item
|
||||||
|
}
|
||||||
|
|
||||||
rowQuantitySelectorView.onPickerDidSelect = { [weak self] item in
|
rowQuantitySelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
self?.widthTextField.isEnabled = item.intValue == 0
|
|
||||||
|
|
||||||
if UIDevice.isIPad {
|
if UIDevice.isIPad {
|
||||||
self?.component.rowQuantityTablet = item.intValue
|
self?.component.rowQuantityTablet = item.intValue
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user