Size Class Agnosticism
TekEffekt opened this issue · 5 comments
SnappyTestCase can simulate the different frames for each device, but it can't simulate the different size classes for each device. This means that apps that use size classes can't use this library in the way that is intended.
Are there are any possible remedies that exist?
Thank you for finding that issue! We could try to handle size classes by passing to UIScreen
a UITraitCollection
instance instead of manually setting scale
and orientation
. I'll perform some experiments to find out whether it would work.
Good idea, I'll keep an eye out for that update!
@TheEffekted If you have any working solution, you're welcome to open PR. I'm not ready with mine yet :(
@pstasiak It seems to work fine as long as you take a snapshot of a UIWindow(with a root view controller), and not the view itself.
Size classes are properly simulated this way. I believe that you do the same thing in the sample project.
window = UIWindow() window.makeKeyAndVisible() let holder = UIViewController() sut.frame = holder.view.bounds holder.view.addSubview(sut) window.rootViewController = holder