carousel to container
This commit is contained in:
parent
03f64b0875
commit
cd9e63b992
@ -11,7 +11,8 @@ import UIKit
|
||||
open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeViewProtocol, MoleculeListCellProtocol {
|
||||
open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
||||
open var json: [AnyHashable: Any]?
|
||||
|
||||
public let containerHelper = ContainerHelper()
|
||||
|
||||
// In updateView, will set padding to default.
|
||||
open var updateViewHorizontalDefaults = true
|
||||
open var updateViewVerticalDefaults = true
|
||||
@ -91,21 +92,19 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi
|
||||
return
|
||||
}
|
||||
if molecule == nil {
|
||||
if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: true) {
|
||||
if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: false) {
|
||||
contentView.insertSubview(moleculeView, at: 0)
|
||||
NSLayoutConstraint.activate(Array(NSLayoutConstraint.pinView(toSuperview: moleculeView, useMargins: true).values))
|
||||
containerHelper.constrainView(moleculeView)
|
||||
molecule = moleculeView
|
||||
}
|
||||
} else {
|
||||
molecule?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
// This molecule will handle spacing by default.
|
||||
if let castView = molecule as? MVMCoreUIViewConstrainingProtocol {
|
||||
castView.shouldSetHorizontalMargins?(false)
|
||||
castView.shouldSetVerticalMargins?(false)
|
||||
}
|
||||
|
||||
guard let molecule = molecule else { return }
|
||||
containerHelper.set(with: json, for: molecule)
|
||||
|
||||
accessibilityElements = molecule?.subviews
|
||||
accessibilityElements = molecule.subviews
|
||||
}
|
||||
|
||||
public func reset() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user