Chapter 11 - Now it's not possible to render any SwiftUI previews


After refactoring the code to meet the pattern MVVM (Chapter 11) I noticed that preview stopped working. This feature is kind of neat because it speeds up SwiftUI development and now, at this point, the only way to check how the user interface looks like is by running the simulator.

The error that is happening is described by Xcode as:

Failed to build ChecklistView.swift
Compiling failed: ‘ContentView_Previews’ is not a member type of ‘Checklist’

After a bit of searching I found: FB7370352: SwiftUI preview crashes when product module name is same as class from Foundation/UIKit · Issue #52 · feedback-assistant/reports · GitHub
I tested it and seems to fix the problem but… I wonder if the authors are aware of this issue. Do they know or suggest a proper way to fix it?

Thank you much for the help.
Best regards.

Hi @gonzalosuarez, thank you for bringing this issue to our attention and for providing a link with a working solution. @ganem do you have a suggestion for this issue? Thanks!

I’ll take a look. Thanks for pointing this out.

@accordionguy I believe this is in your domain? Can you verify please?

@gonzalosuarez Do you still have issues with this?

This topic was automatically closed after 166 days. New replies are no longer allowed.