Commit d5605753 by Daniel Dahan

development: issue-510: fixed issue where visualLayer was not initialized in TableViewCell

parent d9c19489
...@@ -39,7 +39,7 @@ open class Button: UIButton { ...@@ -39,7 +39,7 @@ open class Button: UIButton {
allows the dropshadow effect on the backing layer, while clipping allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer. the image to a desired shape within the visualLayer.
*/ */
open private(set) var visualLayer: CAShapeLayer! open private(set) lazy var visualLayer = CAShapeLayer()
/// An Array of pulse layers. /// An Array of pulse layers.
public private(set) lazy var pulseLayers = [CAShapeLayer]() public private(set) lazy var pulseLayers = [CAShapeLayer]()
...@@ -237,7 +237,6 @@ open class Button: UIButton { ...@@ -237,7 +237,6 @@ open class Button: UIButton {
/// Prepares the visualLayer property. /// Prepares the visualLayer property.
internal func prepareVisualLayer() { internal func prepareVisualLayer() {
visualLayer = CAShapeLayer()
visualLayer.zPosition = 0 visualLayer.zPosition = 0
visualLayer.masksToBounds = true visualLayer.masksToBounds = true
layer.addSublayer(visualLayer) layer.addSublayer(visualLayer)
......
...@@ -39,16 +39,18 @@ open class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -39,16 +39,18 @@ open class MaterialCollectionReusableView: UICollectionReusableView {
allows the dropshadow effect on the backing layer, while clipping allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer. the image to a desired shape within the visualLayer.
*/ */
open private(set) var visualLayer: CAShapeLayer! open private(set) lazy var visualLayer = CAShapeLayer()
/// An Array of pulse layers. /// An Array of pulse layers.
open private(set) lazy var pulseLayers = [CAShapeLayer]() open private(set) lazy var pulseLayers = [CAShapeLayer]()
/// The opcaity value for the pulse animation. /// The opcaity value for the pulse animation.
@IBInspectable open var pulseOpacity: CGFloat = 0.25 @IBInspectable
open var pulseOpacity: CGFloat = 0.25
/// The color of the pulse effect. /// The color of the pulse effect.
@IBInspectable open var pulseColor = Color.grey.base @IBInspectable
open var pulseColor = Color.grey.base
/// The type of PulseAnimation. /// The type of PulseAnimation.
open var pulseAnimation = PulseAnimation.pointWithBacking open var pulseAnimation = PulseAnimation.pointWithBacking
...@@ -58,7 +60,8 @@ open class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -58,7 +60,8 @@ open class MaterialCollectionReusableView: UICollectionReusableView {
property. Images should not be set to the backing layer's contents property. Images should not be set to the backing layer's contents
property to avoid conflicts when using clipsToBounds. property to avoid conflicts when using clipsToBounds.
*/ */
@IBInspectable open var image: UIImage? { @IBInspectable
open var image: UIImage? {
didSet { didSet {
visualLayer.contents = image?.cgImage visualLayer.contents = image?.cgImage
} }
...@@ -271,7 +274,6 @@ open class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -271,7 +274,6 @@ open class MaterialCollectionReusableView: UICollectionReusableView {
/// Prepares the visualLayer property. /// Prepares the visualLayer property.
internal func prepareVisualLayer() { internal func prepareVisualLayer() {
visualLayer = CAShapeLayer()
visualLayer.zPosition = 0 visualLayer.zPosition = 0
visualLayer.masksToBounds = true visualLayer.masksToBounds = true
layer.addSublayer(visualLayer) layer.addSublayer(visualLayer)
......
...@@ -42,16 +42,18 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -42,16 +42,18 @@ open class CollectionViewCell: UICollectionViewCell {
allows the dropshadow effect on the backing layer, while clipping allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer. the image to a desired shape within the visualLayer.
*/ */
open private(set) var visualLayer: CAShapeLayer! open private(set) lazy var visualLayer = CAShapeLayer()
/// An Array of pulse layers. /// An Array of pulse layers.
open private(set) lazy var pulseLayers = [CAShapeLayer]() open private(set) lazy var pulseLayers = [CAShapeLayer]()
/// The opcaity value for the pulse animation. /// The opcaity value for the pulse animation.
@IBInspectable open var pulseOpacity: CGFloat = 0.25 @IBInspectable
open var pulseOpacity: CGFloat = 0.25
/// The color of the pulse effect. /// The color of the pulse effect.
@IBInspectable open var pulseColor: UIColor = Color.grey.base @IBInspectable
open var pulseColor = Color.grey.base
/// The type of PulseAnimation. /// The type of PulseAnimation.
open var pulseAnimation = PulseAnimation.pointWithBacking open var pulseAnimation = PulseAnimation.pointWithBacking
...@@ -282,7 +284,6 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -282,7 +284,6 @@ open class CollectionViewCell: UICollectionViewCell {
/// Prepares the visualLayer property. /// Prepares the visualLayer property.
internal func prepareVisualLayer() { internal func prepareVisualLayer() {
visualLayer = CAShapeLayer()
visualLayer.zPosition = 0 visualLayer.zPosition = 0
visualLayer.masksToBounds = true visualLayer.masksToBounds = true
layer.addSublayer(visualLayer) layer.addSublayer(visualLayer)
......
...@@ -38,7 +38,7 @@ open class Layer: CAShapeLayer { ...@@ -38,7 +38,7 @@ open class Layer: CAShapeLayer {
allows the dropshadow effect on the backing layer, while clipping allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer. the image to a desired shape within the visualLayer.
*/ */
open private(set) var visualLayer: CAShapeLayer! open private(set) lazy var visualLayer = CAShapeLayer()
/** /**
A property that manages an image for the visualLayer's contents A property that manages an image for the visualLayer's contents
...@@ -165,7 +165,6 @@ open class Layer: CAShapeLayer { ...@@ -165,7 +165,6 @@ open class Layer: CAShapeLayer {
/// Prepares the visualLayer property. /// Prepares the visualLayer property.
open func prepareVisualLayer() { open func prepareVisualLayer() {
visualLayer = CAShapeLayer()
visualLayer.zPosition = 0 visualLayer.zPosition = 0
visualLayer.masksToBounds = true visualLayer.masksToBounds = true
addSublayer(visualLayer) addSublayer(visualLayer)
......
...@@ -38,7 +38,7 @@ open class TableViewCell: UITableViewCell { ...@@ -38,7 +38,7 @@ open class TableViewCell: UITableViewCell {
allows the dropshadow effect on the backing layer, while clipping allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer. the image to a desired shape within the visualLayer.
*/ */
open internal(set) var visualLayer: CAShapeLayer! open private(set) lazy var visualLayer = CAShapeLayer()
/// An Array of pulse layers. /// An Array of pulse layers.
open private(set) lazy var pulseLayers = [CAShapeLayer]() open private(set) lazy var pulseLayers = [CAShapeLayer]()
......
...@@ -39,7 +39,7 @@ open class View: UIView { ...@@ -39,7 +39,7 @@ open class View: UIView {
allows the dropshadow effect on the backing layer, while clipping allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer. the image to a desired shape within the visualLayer.
*/ */
open private(set) var visualLayer: CAShapeLayer! open private(set) lazy var visualLayer = CAShapeLayer()
/** /**
A property that manages an image for the visualLayer's contents A property that manages an image for the visualLayer's contents
...@@ -180,7 +180,6 @@ open class View: UIView { ...@@ -180,7 +180,6 @@ open class View: UIView {
/// Prepares the visualLayer property. /// Prepares the visualLayer property.
internal func prepareVisualLayer() { internal func prepareVisualLayer() {
visualLayer = CAShapeLayer()
visualLayer.zPosition = 0 visualLayer.zPosition = 0
visualLayer.masksToBounds = true visualLayer.masksToBounds = true
layer.addSublayer(visualLayer) layer.addSublayer(visualLayer)
......
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