0

In Xcode 9, I did some UI spot checking using the "view as" feature in Xcode 9 (which was previously in Xcode 8, but is now much more robust).

But now I don't know how to reset this filter*, and now any new constraint I add is created using the size class wC hR. In Xcode 8, I just reset it back to wAny hAny, but this apparently doesn't exist in Xcode 9.

But alas, every new constraint I add is being created with this specific size class:

Instead of:

How can I reset the size class "view as" so that constraints created default to wAny hAny, or "any size class"?

As @matt points out, understandably this isn't a filter per-se, but it still behaves as if it were - filtering the view to only show specific size-class constraints. In Xcode 8 you could reset the view to show constraints for "any any", per "Any" size class missing in Xcode 8.

brandonscript
  • 68,675
  • 32
  • 163
  • 220

1 Answers1

0

What you're displaying in your screen shot is not a "size class filter". It's just the displayed dimensions of the view controller's view. It says wChR because those are the size classes for the device type / view size you've selected (you've picked an iPhone in portrait). If you want different dimensions, click the appropriate icons to select the dimensions you want. But nothing is being "filtered" here.

You can never display "Any Any" in the spot shown in your screen shot, because that is not true of any device; no matter what device you select, it has some size classes associated with it, and you will be told what they are.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Matt is correct, and if you look at the Utilities panel -> Size inspector -> Constraints you will see the 'This Size Class' selection is selected. You could change this to 'All' which would add that constraint to "All" size classes. However, I would not suggest doing that. The point in having a constraint layout system/Autolayout is to leverage the size classes to make the app look great on all devices. Use the "Vary for Traits" button on the bottom right. – Jacob Boyd Dec 18 '17 at 19:48
  • 1
    Correct. The "Vary For Traits" button _is_ a kind of filter. But that filter is not in effect in your screen shot; if it were, everything would be blue, and it isn't. – matt Dec 18 '17 at 19:50
  • OK, maybe I'm confused based on how this behaved in Xcode 8? Previously it looked like this: https://stackoverflow.com/questions/38257754/any-size-class-missing-in-xcode-8. When selected, constraints were created for all size classes, or a subset if you "filtered". I'm happy to edit the question, but I need to know what to ask before I can do that. – brandonscript Dec 18 '17 at 20:26
  • I can't tell you because I have no idea what you want to know! I suspect they realized the whole "Any Any" thing was misleading. You'll never see that, and rightly so, because you'll never be in that situation. There are always size classes in effect. To check your constraints against different size classes that might be in effect, try different screen / device sizes / orientations. But now you are just making me repeat myself (since that's what I already said in my answer). – matt Dec 18 '17 at 20:39
  • Alright, fine - assuming "any any" is a misnomer, it still doesn't change the fact that Xcode is creating new constraints with a specific, selected size class. In Xcode 8, this is where I controlled that ability. If it's changed in Xcode 9 (or I was never doing it right in the first place?) I'd like to know. Added two new screenshots to help illustrate what I'm seeing. – brandonscript Dec 19 '17 at 00:09
  • "it still doesn't change the fact that Xcode is creating new constraints with a specific, selected size class" It only does that if Vary For Traits is turned on. It does not appear to be turned on (your screen shot would be blue). If it is on, click Done Varying. If you are getting conditional constraints when Vary For Traits is not turned on, you have found a bug in Xcode. I suggest restarting the computer, removing all Xcode-related caches, and trying again. If that doesn't help, report this to Apple, as it is wrong behavior. – matt Dec 19 '17 at 00:39