-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
82 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/API.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// this file is generated | ||
|
||
public struct Backend { | ||
static var apiConfiguration: AWSAPIPluginConfiguration { | ||
return .init(apiName: "APIName", | ||
endpoint: "http://endpoint", | ||
endpointType: .graphQL, | ||
region: "us-east-1", | ||
authorizationType: .amazonCognitoUserPools) | ||
} | ||
} | ||
|
||
// Developer's code | ||
import Amplify | ||
|
||
func before() throws { | ||
let plugin = AWSAPIPlugin() | ||
try Amplify.add(plugin: plugin) | ||
try Amplify.configure() | ||
} | ||
|
||
func after() throws { | ||
let plugin: AWSAPIPlugin | ||
#if DEBUG | ||
plugin = AWSAPIPlugin(configuration: .dev) | ||
#else | ||
plugin = AWSAPIPlugin(configuration: .prod) | ||
#endif | ||
try Amplify.add(plugin: plugin) | ||
try Amplify.configure() | ||
} | ||
|
||
extension AWSAPIPluginConfiguration { | ||
static let prod: Self = .init( | ||
apiName: "APIName", | ||
endpoint: "http://endpoint", | ||
endpointType: .graphQL, | ||
region: "", | ||
authorizationType: .amazonCognitoUserPools | ||
) | ||
|
||
static let dev: Self = .init( | ||
apiName: "", | ||
endpoint: "", | ||
endpointType: .graphQL, | ||
region: "", | ||
authorizationType: .amazonCognitoUserPools | ||
) | ||
} | ||
|
||
//final class FeatureModel: ObservableObject { | ||
// @Dependency(\.api) var api | ||
// @Dependency(\.auth) var auth | ||
// | ||
// | ||
// | ||
//} | ||
|
||
|
||
//AmplifySwiftDependencies // package | ||
//AmplifyStorageSDWebImage // package of extensions with storage and SDWebImage | ||
|
||
|
||
|
8 changes: 8 additions & 0 deletions
8
AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIPluginConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters