h0mayun h0mayun - 1 month ago 5
Swift Question

xcode 8 live preview not previewing properly

I have updated xcode to the last version (V8.0).
In the previous stable version, the live preview sections shows the app exactly how it would be in the device.
However, in the new version, the live preview sections shows the app exactly how it appears into interface builder.


how can I have the live preview as it was before?

Any idea will be appreciated.

Thanks in advance.

Answer

The Interface Builder of Xcode 8 has been thoroughly reengineered. It is not possible to set it back to the Interface Builder of Xcode 7.

You have two options.

Either you download Xcode 7.3.1 from the Apple developer center. But you'll lose the ability to use Swift 3. This option is absolutely not recommended since you'll also lose future updates and future new features.

Or you make yourself familiar with the new Interface Builder. That option is recommended. The Apple promotion tells you exactly why:

See a live preview of exactly how your app will appear on any Apple device with full vibrancy. As you quickly switch between different devices to customize your UI for size classes, you will always see the same interface as your customers. Pan and zoom are incredibly fast, and you can even edit your interfaces when fully zoomed out for a bird's eye view of your storyboard.

A Beginner’s Guide to Auto Layout with Xcode 8

Also I can advise you to look at this thread. I had issues with the new Interface Builder as well. The key answer: Split big Storyboard into many small ones. And update the Constraints from Xcode 7 projects as suggested in the answer:

1) Remove only one of the "Height equals: xx" constraint from one of your views inside the cell. 2) Update all frames. 3) Select the view you removed constraint from. 4) Click to add new constraint button. Now it should be showing a new height, probably with a decimal value. 5) Add height constraint without changing the value inside the box.

But splitting my Storyboard into many smaller ones did the trick. Take a Storyboard for every scene of your App. Like Login. Tweets. Pictures. Settings.