Open NachoSoto opened 10 months ago
We wanted this as well, though for a different reason https://github.com/pointfreeco/swift-snapshot-testing/issues/673#issuecomment-1854845578
We made a custom Snapshotting
instance named opaqueImage
that always adds a white background to the image. I'm not sure it reduces the file size, but it's a step closer to being able to do that.
Snapshotting<UIView, UIImage>
.image(
size: size,
traits: traits
)
.pullback { view in
let backgroundView = UIView(frame: view.frame)
backgroundView.backgroundColor = .white
backgroundView.preservesSuperviewLayoutMargins = true
backgroundView.addSubview(view)
return backgroundView
}
Looks like there is no way to make snapshots opaque? It would save a lot of space to remove the alpha channel when not needed.