File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Amplify/Core/Configuration Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ extension Amplify {
9595 ///
9696 /// - Parameter configuration: The AmplifyConfiguration for specified Categories
9797 public static func configure( _ configuration: AmplifyConfiguration ? = nil ) throws {
98+ guard !isRunningForSwiftUIPreviews else {
99+ log. info ( " Running for SwiftUI reviews, skipping configuration. " )
100+ return
101+ }
98102 log. info ( " Configuring " )
99103 log. debug ( " Configuration: \( String ( describing: configuration) ) " )
100104 guard !isConfigured else {
@@ -178,4 +182,9 @@ extension Amplify {
178182 }
179183 }
180184
185+ //// Indicates is the runtime is for SwiftUI Previews
186+ private static var isRunningForSwiftUIPreviews : Bool {
187+ ProcessInfo . processInfo. environment [ " XCODE_RUNNING_FOR_PREVIEWS " ] != nil
188+ }
189+
181190}
Original file line number Diff line number Diff line change 11# Changelog
22## Unreleased
33
4+ ### Features
5+
6+ - **Core**: Supports SwiftUI by not running `Amplify.configure` while running for Previews #1509
7+
8+
49## 1.16.1 (2021-11-19)
510
611## 1.16.0 (2021-11-18)
You can’t perform that action at this time.
0 commit comments