Currently, I am trying to learn how to program within Xcode. I have been reading the App Development with Swift book, and as such have been trying to use the labs within the book, to help with my understanding of the Swift programming language. However, whenever I try to open one of these labs, my computer screen starts to flicker, with sections of it going black for a second or two. Following this, all of the screen, except the mouse, will freeze completely. The clock freezes, every app freezes, and it will even stop midway through changing desktops. Sometimes, it will freeze indefinitely, and sometimes it will resume after half an hour if not more. I have had to force restart my computer several times as a result of the freezing.
However, it only happens whenever I open the labs. Nothing else will cause this, and if I quit Xcode before it freezes, everything will go back to normal, so I’m relatively confident it’s not a hardware issue.
I have deleted the labs, and then reinstalled them from the site, but the problem was not solved by this. I checked in the System information area, and it says in the Developer section that I am running Xcode 9.4.1, of which is correct. I’ve checked the crash reports, and run EtreCheck, so if those are needed I would be happy to provide the results.
Does anyone know what I should do? Any help would be greatly appreciated. It seems like nobody else is encountering such an issue.
I'm using macOS High Sierra, with a MacBook, if that helps.