SwiftUI preview doesn't load, CPU Usage 100%

I am on a MBA 2013 running Big Sur. I'm trying to learn swift UI and have just one file with SwiftUI code that loads a List.

However, I'm unable to get a preview. The activity indicator goes on and on and the CPU usage is 100%, also affecting all other activity like browsing and keyboard input.

Even when I used storyboard a few weeks back, when navigating to the storyboard file from any other file in Xcode, I see activity indicator and it takes a while to load the storyboard.

In case of the SwiftUI preview, it simply fails after the activity period.

Overall, my mac takes about few seconds to launch apps. But from what I read on the internet thats normal for ssd's to slow down over time.

Could something be wrong. Have tried reboots. Or is it just an old mac?

Replies

No one facing a similar issue?

Few more things...

  1. Moved the project folder from iCloud folder.
  2. Learnt that Lists have this issue. Tried with other view but same problem. CPU usage goes 100%
  3. CPU usage remains 100% until Xcode is quit from background.
  4. Loading preview also takes a lot of time.