Brejuro
Brejuro

Reputation: 3541

SwiftUI builds successfully but preview fails

I'm on the latest OS and Xcode version (11.2) and for some reason my canvas just will not build. I keep getting X is not a member of PROJECT error. It's driving me insane. It was working not that long ago and I have no idea what changed to make it fail like this. I've also tried deleting Derived Data, restarting laptop...

I've made sure that all my files are included in my target and everything looks like it should be working properly, the app itself builds perfectly fine it's just the preview

Upvotes: 1

Views: 4108

Answers (2)

Manny
Manny

Reputation: 1778

So I had this same issue except I found out it was because I have custom build configurations and it didn't like the custom module name Xcode made. The solution was to rename the module to the same thing as debug and release in Build Settings > Product Module Name

I hope this helps someone

Upvotes: 4

Brejuro
Brejuro

Reputation: 3541

The solution to my problem was that I had a file within my project named the same as my project name. The error messaging was not useful at all in solving this, but once I had renamed that file, the preview began working again.

Upvotes: 3

Related Questions