change float to cgfloat for nslayoutconstraint
This commit is contained in:
parent
d17ab73d34
commit
bf27d19ae1
@ -13,11 +13,11 @@ import UIKit
|
||||
public var backgroundColor: String?
|
||||
public var molecules: [CarouselItemModel]
|
||||
|
||||
public var spacing: Float?
|
||||
public var spacing: CGFloat?
|
||||
public var border: Bool?
|
||||
public var loop: Bool?
|
||||
public var height: Float?
|
||||
public var itemWidthPercent: Float?
|
||||
public var height: CGFloat?
|
||||
public var itemWidthPercent: CGFloat?
|
||||
public var itemAlignment: String?
|
||||
public var pagingMolecule: PagingMoleculeProtocol?
|
||||
|
||||
@ -40,11 +40,11 @@ import UIKit
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
molecules = try typeContainer.decode([CarouselItemModel].self, forKey: .molecules)
|
||||
spacing = try typeContainer.decodeIfPresent(Float.self, forKey: .spacing)
|
||||
spacing = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .spacing)
|
||||
border = try typeContainer.decodeIfPresent(Bool.self, forKey: .border)
|
||||
loop = try typeContainer.decodeIfPresent(Bool.self, forKey: .loop)
|
||||
height = try typeContainer.decodeIfPresent(Float.self, forKey: .height)
|
||||
itemWidthPercent = try typeContainer.decodeIfPresent(Float.self, forKey: .itemWidthPercent)
|
||||
height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
|
||||
itemWidthPercent = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .itemWidthPercent)
|
||||
itemAlignment = try typeContainer.decodeIfPresent(String.self, forKey: .itemAlignment)
|
||||
pagingMolecule = try typeContainer.decodeIfPresent(codingKey: .pagingMolecule) as? PagingMoleculeProtocol
|
||||
}
|
||||
|
||||
@ -98,11 +98,11 @@ open class Carousel: ViewConstrainingView, ModelMoleculeViewProtocol {
|
||||
registerCells(with: caroselModel, delegateObject: delegateObject)
|
||||
setupLayout(with: caroselModel)
|
||||
prepareMolecules(with: caroselModel)
|
||||
itemWidthPercent = CGFloat((caroselModel.itemWidthPercent ?? 100) / 100)
|
||||
itemWidthPercent = (caroselModel.itemWidthPercent ?? 100) / 100
|
||||
setAlignment(with: caroselModel.itemAlignment)
|
||||
|
||||
if let height = caroselModel.height {
|
||||
collectionViewHeight?.constant = CGFloat(height)
|
||||
collectionViewHeight?.constant = height
|
||||
collectionViewHeight?.isActive = true
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ open class Carousel: ViewConstrainingView, ModelMoleculeViewProtocol {
|
||||
func setupLayout(with carouselModel: CarouselModel?) {
|
||||
let layout = UICollectionViewFlowLayout()
|
||||
layout.scrollDirection = .horizontal
|
||||
layout.minimumLineSpacing = CGFloat(carouselModel?.spacing ?? 1)
|
||||
layout.minimumLineSpacing = carouselModel?.spacing ?? 1
|
||||
layout.minimumInteritemSpacing = 0
|
||||
collectionView.collectionViewLayout = layout
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user