Removing bars indicator animation

Removing dispatch to main thread during initial template load
This commit is contained in:
Scott Pfeil 2024-06-03 13:19:01 -04:00
parent e0caceaf61
commit 012d677b0f
2 changed files with 16 additions and 24 deletions

View File

@ -123,6 +123,7 @@ open class BarsIndicatorView: CarouselIndicator {
bottomAnchor.constraint(equalTo: stackView.bottomAnchor), bottomAnchor.constraint(equalTo: stackView.bottomAnchor),
trailingAnchor.constraint(equalTo: stackView.trailingAnchor) trailingAnchor.constraint(equalTo: stackView.trailingAnchor)
]) ])
bounds = CGRectMake(0, 0, 100, Padding.One)
} }
//-------------------------------------------------- //--------------------------------------------------
@ -262,7 +263,6 @@ open class BarsIndicatorView: CarouselIndicator {
refreshAccessibilityLabels() refreshAccessibilityLabels()
} }
let expression = { [self] in
barReferences[previousIndex].backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor barReferences[previousIndex].backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
barReferences[previousIndex].constraint?.constant = IndicatorBar.unselectedHeight barReferences[previousIndex].constraint?.constant = IndicatorBar.unselectedHeight
barReferences[previousIndex].layer.cornerRadius = IndicatorBar.unselectedCornerRadius barReferences[previousIndex].layer.cornerRadius = IndicatorBar.unselectedCornerRadius
@ -271,8 +271,4 @@ open class BarsIndicatorView: CarouselIndicator {
barReferences[newIndex].layer.cornerRadius = IndicatorBar.selectedCornerRadius barReferences[newIndex].layer.cornerRadius = IndicatorBar.selectedCornerRadius
layoutIfNeeded() layoutIfNeeded()
} }
// Perform the animation.
isAnimated ? UIView.animate(withDuration: 0.25) { expression() } : expression()
}
} }

View File

@ -264,7 +264,7 @@ import MVMCore
self.pageModel = newPageModel self.pageModel = newPageModel
// Run through the differences between separate page model trees. // Run through the differences between separate page model trees.
var pageUpdatedModels = [MoleculeModelProtocol]() //var pageUpdatedModels = [MoleculeModelProtocol]()
if let originalModel, // We had a prior. if let originalModel, // We had a prior.
let newPageModel = newPageModel as? TemplateModelProtocol, let newPageModel = newPageModel as? TemplateModelProtocol,
originalModel.id != newPageModel.id { originalModel.id != newPageModel.id {
@ -280,9 +280,6 @@ import MVMCore
// Warning: Some flows cause table reloads. Until the UI update is decoupled, should be after the updateUI. // Warning: Some flows cause table reloads. Until the UI update is decoupled, should be after the updateUI.
manager?.newDataReceived?(in: self) manager?.newDataReceived?(in: self)
// Dispatch to decouple execution. First massage data through template classes, then render.
Task { @MainActor in
if allUpdatedMolecules.isEmpty || isFirstRender { if allUpdatedMolecules.isEmpty || isFirstRender {
debugLog("Performing full page render...") debugLog("Performing full page render...")
updateUI() updateUI()
@ -291,7 +288,6 @@ import MVMCore
updateUI(for: allUpdatedMolecules) updateUI(for: allUpdatedMolecules)
} }
} }
}
/// Applies the latest model to the UI. /// Applies the latest model to the UI.
open func updateUI(for molecules: [MoleculeModelProtocol]? = nil) { open func updateUI(for molecules: [MoleculeModelProtocol]? = nil) {