Skip to content

Commit ef928d6

Browse files
committed
Remove preview warning
It's not super helpful in practice.
1 parent 1439a8f commit ef928d6

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

Sources/Dependencies/DependencyValues.swift

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -286,38 +286,6 @@ public struct DependencyValues: Sendable {
286286
if DependencyValues.isPreparing {
287287
#if canImport(SwiftUI)
288288
if context == .preview, Thread.isPreviewAppEntryPoint {
289-
reportIssue(
290-
"""
291-
Xcode Previews: Ignoring dependencies prepared in app entry point.
292-
293-
To silence this warning, use the dependency context to conditionally prepare them:
294-
295-
import Dependencies
296-
import SwiftUI
297-
298-
@main
299-
struct MyApp: App {
300-
+ @Dependency(\\.context) var context
301-
init() {
302-
+ // Don't prepare app dependencies in previews/tests.
303-
+ guard context == .live else { return }
304-
prepareDependencies {
305-
// ...
306-
}
307-
// ...
308-
}
309-
310-
var body: some Scene {
311-
WindowGroup {
312-
+ // Don't load root view in previews/tests.
313-
+ if context == .live {
314-
// ...
315-
+ }
316-
}
317-
}
318-
}
319-
"""
320-
)
321289
return
322290
}
323291
#endif

0 commit comments

Comments
 (0)