Testing json override.

Prospect images
tabs and carousel fixes
new json
This commit is contained in:
Scott Pfeil 2023-05-19 14:33:47 -04:00
parent a5fcceca9b
commit 9b048ccd5a
3 changed files with 28 additions and 6 deletions

View File

@ -51,7 +51,7 @@ import VDSColorTokens
public let selectionLineMovingTime: TimeInterval = 0.2
//-------------------------------------------------
// MARK:- Layout Views
// MARK: - Layout Views
//-------------------------------------------------
open override func reset() {
@ -122,8 +122,27 @@ import VDSColorTokens
NSLayoutConstraint.constraintPinSubview(bottomLine, pinTop: false, pinBottom: true, pinLeft: true, pinRight: true)
}
open override func layoutSubviews() {
super.layoutSubviews()
// Accounts for any collection size changes
DispatchQueue.main.async {
self.layoutCollection()
}
}
/// Invalidates the layout and ensures we are paged to the correct cell.
open func layoutCollection() {
collectionView?.collectionViewLayout.invalidateLayout()
// Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled.
DispatchQueue.main.async {
self.collectionView?.scrollToItem(at: IndexPath(row: self.selectedIndex, section: 0), at: .left, animated: false)
self.collectionView?.layoutIfNeeded()
}
}
//-------------------------------------------------
// MARK:- Control Methods
// MARK: - Control Methods
//-------------------------------------------------
public func selectIndex(_ index: Int, animated: Bool) {
@ -146,7 +165,7 @@ import VDSColorTokens
}
//-------------------------------------------------
// MARK:- Molecule Setup
// MARK: - Molecule Setup
//-------------------------------------------------
override open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
@ -163,7 +182,7 @@ import VDSColorTokens
}
//-------------------------------------------------
// MARK:- Collection View Methods
// MARK: - Collection View Methods
//-------------------------------------------------
extension Tabs: UICollectionViewDataSource {
@ -281,7 +300,7 @@ extension Tabs: UIScrollViewDelegate {
//-------------------------------------------------
// MARK:- Bottom Line Methods
// MARK: - Bottom Line Methods
//-------------------------------------------------
extension Tabs {
func moveSelectionLine(toIndex indexPath: IndexPath, animated: Bool, cell: TabItemCell) {

View File

@ -47,6 +47,7 @@ import UIKit
public override func reset() {
super.reset()
tabs.reset()
tabs.paddingBeforeFirstTab = false
}
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { 46 }

View File

@ -104,6 +104,7 @@ open class Carousel: View {
super.setupView()
collectionView.dataSource = self
collectionView.delegate = self
collectionView.bounces = false
addSubview(collectionView)
bottomPin = NSLayoutConstraint.constraintPinSubview(toSuperview: collectionView)?[ConstraintBot] as? NSLayoutConstraint
collectionViewHeight = collectionView.heightAnchor.constraint(equalToConstant: 300)
@ -129,7 +130,8 @@ open class Carousel: View {
inset.left = carouselModel?.leftPadding ?? Padding.Component.horizontalPaddingForSize(size)
inset.right = carouselModel?.rightPadding ?? Padding.Component.horizontalPaddingForSize(size)
}
(collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.sectionInset = inset
collectionView.contentInset = inset
//(collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.sectionInset = inset
// Update cells and re-layout.
for cell in collectionView.visibleCells {