Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Sources/StackKit/HStackLayerWrapperView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,14 @@ open class HStackLayerWrapperView: UIView {
subview._tryFixSize()

// Copy UIImageView
if subview is UIImageView {
if let imageView = subview as? UIImageView {
let imageLayer = CALayer()
imageLayer.contents = subview.layer.contents
// fix subview.layer.contents is nil below on iOS 15?
// test on iOS 14.3, subview.layer.contents is nil,
// test on iOS 15, subview.layer.contents has some value.
// imageLayer.contents = subview.layer.contents

imageLayer.contents = imageView.image?.cgImage
imageLayer.bounds = subview.layer.bounds
imageLayer.backgroundColor = subview.backgroundColor?.cgColor
layer.addSublayer(imageLayer)
Expand Down
9 changes: 7 additions & 2 deletions Sources/StackKit/VStackLayerWrapperView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,14 @@ open class VStackLayerWrapperView: UIView {
subview._tryFixSize()

// Copy UIImageView
if subview is UIImageView {
if let imageView = subview as? UIImageView {
let imageLayer = CALayer()
imageLayer.contents = subview.layer.contents
// fix subview.layer.contents is nil below on iOS 15?
// test on iOS 14.3, subview.layer.contents is nil,
// test on iOS 15, subview.layer.contents has some value.
// imageLayer.contents = subview.layer.contents

imageLayer.contents = imageView.image?.cgImage
imageLayer.bounds = subview.layer.bounds
imageLayer.backgroundColor = subview.backgroundColor?.cgColor
layer.addSublayer(imageLayer)
Expand Down