Merge remote-tracking branch 'origin/develop' into bugfix/GYNVB-1160
This commit is contained in:
commit
db3e7c22eb
@ -54,7 +54,7 @@ import Foundation
|
|||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func setupView() {
|
open func setupView() {
|
||||||
|
|
||||||
clipsToBounds = true
|
clipsToBounds = true
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
@ -70,7 +70,7 @@ import Foundation
|
|||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
|
||||||
guard let progressBarModel = model as? ProgressBarModel else { return }
|
guard let progressBarModel = model as? ProgressBarModel else { return }
|
||||||
|
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
@objcMembers public class ProgressBarModel: MoleculeModelProtocol {
|
@objcMembers open class ProgressBarModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "progressBar"
|
open class var identifier: String { "progressBar" }
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
@Percent public var percent: CGFloat
|
@Percent public var percent: CGFloat
|
||||||
@ -46,7 +46,7 @@ import Foundation
|
|||||||
thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
|
thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
|||||||
@ -87,7 +87,7 @@ open class Carousel: View {
|
|||||||
showPeaking(false)
|
showPeaking(false)
|
||||||
|
|
||||||
// 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.
|
// 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.
|
||||||
guard let model = model as? CarouselModel,
|
guard let model = model as? CarouselModel, !model.molecules.isEmpty,
|
||||||
(model.paging == true || loop == true) else { return }
|
(model.paging == true || loop == true) else { return }
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.collectionView.scrollToItem(at: IndexPath(row: self.currentIndex, section: 0), at: self.itemAlignment, animated: false)
|
self.collectionView.scrollToItem(at: IndexPath(row: self.currentIndex, section: 0), at: self.itemAlignment, animated: false)
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
@objcMembers public class CarouselModel: ParentMoleculeModelProtocol, FormFieldProtocol {
|
@objcMembers public class CarouselModel: ParentMoleculeModelProtocol, FormFieldProtocol {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -57,14 +56,14 @@ import UIKit
|
|||||||
|
|
||||||
guard selectable else {
|
guard selectable else {
|
||||||
// Use visible item value, else index
|
// Use visible item value, else index
|
||||||
if let fieldValue = molecules[index].formFieldValue() {
|
if let fieldValue = molecules[safe: index]?.formFieldValue() {
|
||||||
return fieldValue
|
return fieldValue
|
||||||
}
|
}
|
||||||
return index
|
return index
|
||||||
}
|
}
|
||||||
// Use selected item value, else index
|
// Use selected item value, else index
|
||||||
guard let selectedIndex = selectedIndex else { return nil }
|
guard let selectedIndex = selectedIndex else { return nil }
|
||||||
guard let fieldValue = molecules[selectedIndex].formFieldValue() else { return selectedIndex }
|
guard let fieldValue = molecules[safe: selectedIndex]?.formFieldValue() else { return selectedIndex }
|
||||||
return fieldValue
|
return fieldValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user