Commit c23a1b97 by Daniel Dahan

development: updated CollectionView internals

parent 391ed843
...@@ -61,10 +61,13 @@ open class CollectionView: UICollectionView { ...@@ -61,10 +61,13 @@ open class CollectionView: UICollectionView {
} }
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
open var interimSpacePreset = InterimSpacePreset.none { open var interimSpacePreset: InterimSpacePreset {
didSet { get {
interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset) return (collectionViewLayout as? CollectionViewLayout)!.interimSpacePreset
} }
set(value) {
(collectionViewLayout as? CollectionViewLayout)!.interimSpacePreset = value
}
} }
/// Spacing between items. /// Spacing between items.
...@@ -120,7 +123,6 @@ open class CollectionView: UICollectionView { ...@@ -120,7 +123,6 @@ open class CollectionView: UICollectionView {
*/ */
open func prepare() { open func prepare() {
contentScaleFactor = Screen.scale contentScaleFactor = Screen.scale
backgroundColor = nil backgroundColor = .white
contentEdgeInsets = .zero
} }
} }
...@@ -150,45 +150,6 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable { ...@@ -150,45 +150,6 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable {
} }
} }
/// A preset wrapper around contentEdgeInsets.
public var contentEdgeInsetsPreset: EdgeInsetsPreset {
get {
return contentView.grid.contentEdgeInsetsPreset
}
set(value) {
contentView.grid.contentEdgeInsetsPreset = value
}
}
/// A reference to EdgeInsets.
@IBInspectable
open var contentEdgeInsets: EdgeInsets {
get {
return contentView.grid.contentEdgeInsets
}
set(value) {
contentView.grid.contentEdgeInsets = value
}
}
/// A preset wrapper around interimSpace.
open var interimSpacePreset = InterimSpacePreset.none {
didSet {
interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset)
}
}
/// A wrapper around grid.interimSpace.
@IBInspectable
open var interimSpace: InterimSpace {
get {
return contentView.grid.interimSpace
}
set(value) {
contentView.grid.interimSpace = value
}
}
/// A property that accesses the backing layer's background /// A property that accesses the backing layer's background
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
......
...@@ -142,10 +142,10 @@ open class CollectionViewLayout: UICollectionViewLayout { ...@@ -142,10 +142,10 @@ open class CollectionViewLayout: UICollectionViewLayout {
layoutItems.append((layoutAttributesForItem(at: indexPath)!, indexPath as NSIndexPath)) layoutItems.append((layoutAttributesForItem(at: indexPath)!, indexPath as NSIndexPath))
offset.x += interimSpace offset.x += interimSpace
offset.x += nil == item.width ? itemSize.width : item.width! offset.x += item.width ?? itemSize.width
offset.y += interimSpace offset.y += interimSpace
offset.y += nil == item.height ? itemSize.height : item.height! offset.y += item.height ?? itemSize.height
} }
offset.x += contentEdgeInsets.right - interimSpace offset.x += contentEdgeInsets.right - interimSpace
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment