feedback-assistant / reports

Open collection of Apple Feedback Assistant reports
226 stars 2 forks source link

FB7370352: SwiftUI preview crashes when product module name is same as class from Foundation/UIKit #52

Open SebastianOsinski opened 4 years ago

SebastianOsinski commented 4 years ago

Description

Xcode SwiftUI preview crashes with error: 'ContentView_Previews' is not a member type of 'XXX' where XXX is Product Module Name when XXX is the same as one of classes from Foundation or UIKit, e.g. UnitConverter

Steps to reproduce

Create new Single View App iOS project in Xcode 11.1(11A1027):

  1. Name project UnitConverter (same as UnitConverter class from Foundation)
  2. Select SwiftUI as User Interface

Expected behavior:

SwiftUI view preview should work

What actually happened?

SwiftUI preview crashes with error: 'ContentView_Previews' is not a member type of 'UnitConverter'. App runs on simulator with no issues. After changing Product Module Name in Build Settings to NotUnitConverter preview works again.

Files

Screen Shot 2019-10-12 at 00 12 41

Example project.zip

xavierLowmiller commented 4 years ago

I'm having the same issue, but with one of my own names, for example:

Product/Module name: Foo Offending class/struct name: Foo

Workarounds:

ejeklint commented 4 years ago

Same here. If project contains a struct that has the same name as the product, preview crashes.

adrianschlatter commented 4 years ago

I see this, too.