diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index 280135f..7d4ebd2 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -733,7 +733,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 72; + CURRENT_PROJECT_VERSION = 73; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77; GENERATE_INFOPLIST_FILE = YES; @@ -769,7 +769,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 72; + CURRENT_PROJECT_VERSION = 73; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77; GENERATE_INFOPLIST_FILE = YES; diff --git a/VDSSample/Classes/Helper.swift b/VDSSample/Classes/Helper.swift index 7fefee7..d81b275 100644 --- a/VDSSample/Classes/Helper.swift +++ b/VDSSample/Classes/Helper.swift @@ -10,15 +10,15 @@ import VDS import UIKit extension UIView { - public func makeWrapper(edgeSpacing: CGFloat = 0.0, isTrailing: Bool = true) -> View { - UIView.makeWrapper(for: self, edgeSpacing: edgeSpacing, isTrailing: isTrailing) + public func makeWrapper(edgeSpacing: CGFloat = 0.0, isTrailing: Bool = true, isBottom: Bool = false) -> View { + UIView.makeWrapper(for: self, edgeSpacing: edgeSpacing, isTrailing: isTrailing, isBottom: isBottom) } - public static func makeWrapper(for view: UIView, edgeSpacing: CGFloat = 0.0, isTrailing: Bool = true) -> View { - makeWrapperWithConstraints(for: view, edgeSpacing: edgeSpacing, isTrailing: isTrailing).view + public static func makeWrapper(for view: UIView, edgeSpacing: CGFloat = 0.0, isTrailing: Bool = true, isBottom: Bool = false) -> View { + makeWrapperWithConstraints(for: view, edgeSpacing: edgeSpacing, isTrailing: isTrailing, isBottom: isBottom).view } - public static func makeWrapperWithConstraints(for view: UIView, edgeSpacing: CGFloat = 0.0, isTrailing: Bool = true) -> (view: View, container: NSLayoutConstraint.Container) { + public static func makeWrapperWithConstraints(for view: UIView, edgeSpacing: CGFloat = 0.0, isTrailing: Bool = true, isBottom: Bool = false) -> (view: View, container: NSLayoutConstraint.Container) { let container = NSLayoutConstraint.Container() let wrapper = View().with { $0.translatesAutoresizingMaskIntoConstraints = false @@ -26,7 +26,11 @@ extension UIView { wrapper.addSubview(view) container.topConstraint = view.pinTop(anchor: wrapper.topAnchor, constant: edgeSpacing) - container.bottomConstraint = view.pinBottom(anchor: wrapper.bottomAnchor, constant: edgeSpacing) + if isBottom { + container.bottomConstraint = view.pinBottomLessThanOrEqualTo(anchor: wrapper.bottomAnchor, constant: edgeSpacing) + } else { + container.bottomConstraint = view.pinBottom(anchor: wrapper.bottomAnchor, constant: edgeSpacing) + } container.leadingConstraint = view.pinLeading(anchor: wrapper.leadingAnchor, constant: edgeSpacing) if isTrailing { container.trailingConstraint = view.pinTrailingLessThanOrEqualTo(anchor: wrapper.trailingAnchor, constant: edgeSpacing) diff --git a/VDSSample/ViewControllers/CarouselViewController.swift b/VDSSample/ViewControllers/CarouselViewController.swift index d5c4bb8..969c594 100644 --- a/VDSSample/ViewControllers/CarouselViewController.swift +++ b/VDSSample/ViewControllers/CarouselViewController.swift @@ -132,18 +132,13 @@ class CarouselViewController: BaseViewController { rows.append(Button().with{ $0.use = .secondary; $0.text = "Shop"; $0.onClick = onClick}) rows.append(Button().with{ $0.use = .secondary; $0.text = "Buy"; $0.onClick = onClick}) rows.append(Button().with{ $0.use = .secondary; $0.text = "Offer"; $0.onClick = onClick}) - component.views = rows.compactMap({ view in - return TileContainer().with { instance in - instance.aspectRatio = .none - instance.addContentView(view) - instance.color = .custom(.lightGray) - } - }) + label.text = "0" - component.slotAlignment = .init(vertical: Carousel.Vertical.top, horizontal: Carousel.Horizontal.left) horizAlignmtPickerSelectorView.text = Carousel.Horizontal.left.rawValue vertAlignmtPickerSelectorView.text = Carousel.Vertical.top.rawValue + + updateCarousel() // Callback when moving the carousel. Returns selectedGroupIndex. component.onChange = { [weak self] selectedGroupIndex in @@ -152,6 +147,16 @@ class CarouselViewController: BaseViewController { } } + func updateCarousel() { + component.views = rows.compactMap({ view in + return TileContainer().with { instance in + instance.aspectRatio = .none + instance.addContentView(view) + instance.color = .custom(.lightGray) + } + }) + } + func setupPicker() { surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in self?.component.surface = item @@ -184,6 +189,7 @@ class CarouselViewController: BaseViewController { gutterPickerSelectorView.onPickerDidSelect = { [weak self] item in self?.component.gutter = item + self?.updateCarousel() } layoutPickerSelectorView.onPickerDidSelect = { [weak self] item in @@ -194,6 +200,7 @@ class CarouselViewController: BaseViewController { } self?.component.layout = item self?.label.text = "0" + self?.updateCarousel() } paginationKindPickerSelectorView.onPickerDidSelect = { [weak self] item in diff --git a/VDSSample/ViewControllers/TableViewController.swift b/VDSSample/ViewControllers/TableViewController.swift index 72cf505..f645f00 100644 --- a/VDSSample/ViewControllers/TableViewController.swift +++ b/VDSSample/ViewControllers/TableViewController.swift @@ -202,11 +202,12 @@ class TableViewController: BaseViewController { trailingToolTip.labelText = "5G Ultra Wideband is available in your area" trailingToolTip.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name") - let image = UIImage(named: "clean-surface") - let imageView = UIImageView(image: image) + + let iconView = Icon() + iconView.name = .cleanSurface rows.append(TableRowModel(columns: [TableItemModel(bottomLine: .secondary, component:textArea), - TableItemModel(bottomLine: .secondary, component:imageView), + TableItemModel(bottomLine: .secondary, component:iconView), TableItemModel(bottomLine: .secondary, component:trailingToolTip)])) }