it need to be updated
Can you be more specific? What are you seeing that isn’t available anymore? Some things have moved around in Xcode versions, but everything still works in the same way.
vary for traits is gone now so how can i specify a custom sizes and layout for a specific device screen now ?
If you are using Xcode 14, vary for traits is done differently than the way it was done in the video you are watching. Unfortunately the course is some years old and there have been changes in the way Xcode works.
Please advise what Module and Lesson you are watching just to make it easier for those of us assisting to find the relevant video and refresh our memories on what the course was about.
OK I now know what you are talking about.
Vary for Traits in Xcode 14 + is now configured by selecting the particular constraint for the object you want to adjust and over on the right hand panel add a new constraint that changes the constant value.
For example with this Social Squid exercise lets assume that you want to operate this device in Landscape mode and when you rotate it (Rotate the device in the storyboard by tapping on the icon down the bottom of the Xcode window which is a square with an arrow pointing to the right), the top object (the label which has Social Squid in it) is pushed up and part of the top is outside the edge of the screen as you can see in the screenshot below:
To fix it I will select the Label and then change the Inspector in the right hand panel to be the “Size inspector”.
You will see two Constraints listed for that object. One to align the object to be in the centre on the horizontal axis and the other specifying the gap between the bottom of the object and the top of the stackView which has a value of 40 points. Double click on the constraint and constraint details will show up in the right hand panel as in the following screenshot and it will also highlight the constraint on the object in the storyboard view:
On the right hand panel you will see a Constant with a value of 40 and a + symbol to the left of that. Tap on the + symbol. You should see a dialog box pop up to allow to configure the new constraint.
It is pre-empting that we might want to introduce a new constraint based on the width being Regular and the height being Compact. (In portrait mode the width is Compact and the height is Regular).
Tap add variation which now gives as this.
Do you see the entry wR hC and a value of 40?
I am going to change the value in my version to 10 and you will see that it will bring the Label down so that the top is no longer off the screen and the label sits a lot closer to the top of the stackView.
Now when I rotate the device back into Portrait mode the label shifts back up to where it was which indicates that the original constraint is taking effect.
Hope that helps