Created
May 24, 2019 05:23
-
-
Save mobilequickie/ec88d9062c02821f24b44c2b0079ac98 to your computer and use it in GitHub Desktop.
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
import UIKit | |
import AWSAppSync // #1 | |
class AWSServicesTableViewController: UITableViewController { | |
// Reference AppSync client | |
var appSyncClient: AWSAppSyncClient? // #2 | |
// Sample data | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
initializeAppSync() // #3 | |
} | |
// #4 | |
// Use this code when setting up AppSync with API_key auth mode. This mode is used for testing our GraphQL mutations, queries, and subscriptions with an API key. | |
func initializeAppSync() { | |
do { | |
// Initialize the AWS AppSync configuration | |
let appSyncConfig = try AWSAppSyncClientConfiguration(appSyncServiceConfig: AWSAppSyncServiceConfig(), | |
cacheConfiguration: AWSAppSyncCacheConfiguration()) | |
// Initialize the AWS AppSync client | |
appSyncClient = try AWSAppSyncClient(appSyncConfig: appSyncConfig) | |
} catch { | |
print("Error initializing appsync client. \(error)") | |
} | |
} | |
// End #4 | |
//... | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment