playbook-ui / playbook-ios

📘A library for isolated developing UI components and automatically taking snapshots of them.
https://playbook-ui.github.io/playbook-ios/documentation/playbooksnapshot/
Apache License 2.0
1.18k stars 55 forks source link

fix: Blank snapshot is generated if it exceeds the internal size limitation #66

Closed ra1028 closed 7 months ago

ra1028 commented 7 months ago

Checklist

Description

"Interestingly", UIView.drawHierarchy seems to have an internal hard-coded limit size of 8192x8192, and specifying a size beyond that resulting in an empty image is drawn. It's reported in Apple's developer forums but there's no way properly address that issue. So this PR adds a workaround that scales down the drawn image into a size that fits within the limitation once and then scales up to the expected size. This may reduce the quality of the generated snapshots, but was not so critical when tested in the sample app.