Skip to content

Avoid launching main app if rendering previews #25

@markst

Description

@markst

Rendering preview's can be optimised by checking XCODE_RUNNING_FOR_PREVIEWS environment variable

@AppBuilder override var body: AppBuilderContent {
  MainScene { .main }
  .mainScreen {
    // Avoid loading `ShowsListViewController` is rendering previews:
    if ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" {
      return UIViewController()
    }
    return NavigationController(ShowsListViewController(viewModel: ShowsListViewModel()))
      .style(.transparent)
      .hideNavigationBar()
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions