MihaelIsaev / MihaelIsaev/UIKitPlus
Avoid launching main app if rendering previews
Open
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 628
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
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()
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the app entry point containing the MainScene and .mainScreen declaration, and inspect how ShowsListViewController is created. Use XCODE_RUNNING_FOR_PREVIEWS as the preview condition, then verify that previews avoid loading the main screen while the normal app path still creates the navigation controller.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100