In the xcode IB is there any way to specify separate constraits depending on the device orientation? Essentially, in portrait I want to use a larger number of stack views (rows) with fewer items each, while in landscape I want a smaller number of stack views (rows) with a larger number of items in each. Is this possible in IB? Do I need to do this programmatically instead?
separate layouts based on device orientation?
Yes, this is possible in IB.
I suggest you start by watching this WWDC video:
https://developer.apple.com/videos/play/wwdc2016/222?time=1162
The IB demo starts at around the 19:25 mark, and that's probably what will interest you most.