Context π΅οΈββοΈ
I have some components that explicitly check against the current device using UIDevice.current.userInterfaceIdiom (I known this might not be a best practice and we are on the road to change this).
When using Xcode previews the component renders correctly, in my case I can confirm that the modifier .lineLimit() reflects the correct value.
What π±
The generated snapshot file doesn't reflects the correct number of lines because alls tests are run on the same device based on the simulator_device key in the config file.
Proposal π
UIDevice has only getters but I think we could use some swizzling on the property UIDevice.current.userInterfaceIdiom based on the current snapshot device.
I haven't tested it but I think it might be interesting to extend to other properties such as UIDevice.current.orientation.
Context π΅οΈββοΈ
I have some components that explicitly check against the current device using
UIDevice.current.userInterfaceIdiom(I known this might not be a best practice and we are on the road to change this).When using Xcode previews the component renders correctly, in my case I can confirm that the modifier
.lineLimit()reflects the correct value.What π±
The generated snapshot file doesn't reflects the correct number of lines because alls tests are run on the same device based on the
simulator_devicekey in the config file.Proposal π
UIDevicehas only getters but I think we could use some swizzling on the propertyUIDevice.current.userInterfaceIdiombased on the current snapshot device.I haven't tested it but I think it might be interesting to extend to other properties such as
UIDevice.current.orientation.