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 {
95
95
///
96
96
/// - Parameter configuration: The AmplifyConfiguration for specified Categories
97
97
public static func configure( _ configuration: AmplifyConfiguration ? = nil ) throws {
98
+ guard !isRunningForSwiftUIPreviews else {
99
+ log. info ( " Running for SwiftUI reviews, skipping configuration. " )
100
+ return
101
+ }
98
102
log. info ( " Configuring " )
99
103
log. debug ( " Configuration: \( String ( describing: configuration) ) " )
100
104
guard !isConfigured else {
@@ -178,4 +182,9 @@ extension Amplify {
178
182
}
179
183
}
180
184
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
+
181
190
}
Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
## Unreleased
3
3
4
+ ### Features
5
+
6
+ - **Core**: Supports SwiftUI by not running `Amplify.configure` while running for Previews #1509
7
+
8
+
4
9
## 1.16.1 (2021-11-19)
5
10
6
11
## 1.16.0 (2021-11-18)
You can’t perform that action at this time.
0 commit comments