Home/Q&A/Are SwiftUI previews and Storyboards slow on a remote Mac?

Are SwiftUI previews and Storyboards slow on a remote Mac?

Updated · airankrush

Direct answer

It depends on which kind of slow. If the preview canvas takes a long time to refresh, the cause is compilation on the remote Mac. If dragging controls cannot keep up with the mouse, the cause is the picture being sent back. The two are eased in different ways.

Basis

  • Every time a SwiftUI preview refreshes, Xcode recompiles the relevant code and runs it in a preview process. This happens entirely on the remote Mac. Its speed depends on the machine's processor and memory, how the project is split into modules, and whether another build is competing for resources at that moment. It has nothing to do with your network route.
  • Working on a Storyboard or xib canvas means dragging, aligning and connecting, which needs the picture to follow the mouse closely. These actions feel sluggish through a remote desktop, to a degree that depends on your local network route and the quality settings of the remote client.
  • In cross-platform projects there are few occasions to touch either of these. Flutter and React Native draw their own UI, and the iOS project usually contains only a launch screen Storyboard. Swapping an image or changing a background color is all it takes, the amount of interaction is small, and a bit of lag is easy to put up with.
  • When previews keep failing or hanging, do a full build of the same scheme first. A common reason for preview failure is that the project itself does not compile, and the error is much clearer in the build log than on the canvas.

Information as of .

Boundaries: when the answer is different

If you want to learn SwiftUI systematically, or write a large amount of native UI with it, previews are something you stare at over and over, and the remote experience is hard to compare with a local one. For long-term work, buying a Mac fits better; for a short trial of learning, see learning Swift and Xcode without a Mac. Instability in Xcode previews themselves (occasional crashes, cache glitches) happens on any Mac and is outside what we can fix. We have no measured data on preview refresh time.

How to do it

  1. When a preview is slow, look at the activity status at the top of Xcode to see whether it is compiling or already idle.
  2. Break the view you are previewing into smaller pieces, and use fake data in previews so they do not depend on network requests or the whole app state.
  3. Close the simulator and other memory-hungry software while previewing.
  4. For fine adjustments in a Storyboard, type the values in instead of dragging with the mouse to align.
  5. If you only need to change the launch screen, close the canvas as soon as you are done and go back to command-line builds.

Use case

This question belongs to the use case: iOS without a Mac: a remote Mac mini can build, sign and upload, but not debug on a real device

Other questions in the same use case:

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All Q&A