Error in Preview

#Preview {
    SwiftUIView()
}

Error:Missing argument for parameter 'isShowing' in call

Whay? can you help me?

Welcome to the forum.

You probably have a var or State var in SwiftUIView, probably a Bool ?

    var isShowing: Bool

or

    @State var isShowing: Bool

If so, you have 2 options

  • assign a value in declaration
    var isShowing: Bool = true

or

    @State var isShowing = true

Or pass the parameter in Preview call

    SwiftUIView(isShowing : true)

Do not forget to close the thread if that works by marking the correct answer. Otherwise, explain and show more code.

Just make isShowing private if it has no external purpose.

Hi,

Sorry to hear you are having problems getting previews working. The above suggestions will likely resolve your issue. If not, the best next step will be to file a feedback with diagnostics so we can take a look.

Steps to generate helpful diagnostics:

  1. Download and install the logging profile on all devices involved. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift
  2. Reproduce the issue
  3. Click the "Diagnostics" button in the error banner in Previews' Canvas area (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  4. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  5. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)
  6. Generate the sysdiagnose(s) and attach those too
Error in Preview
 
 
Q