From 15d0308e89ba999a25d07d12208fded1ce3ca394 Mon Sep 17 00:00:00 2001 From: Eric Shepherd Date: Tue, 1 Oct 2024 14:41:48 -0400 Subject: [PATCH] Updates suggested by Sebastien. --- .../apple/Buckets/Buckets/ContentView-ViewModel.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/swift/example_code/apple/Buckets/Buckets/ContentView-ViewModel.swift b/swift/example_code/apple/Buckets/Buckets/ContentView-ViewModel.swift index 1c905d9634e..a37ac5c1487 100644 --- a/swift/example_code/apple/Buckets/Buckets/ContentView-ViewModel.swift +++ b/swift/example_code/apple/Buckets/Buckets/ContentView-ViewModel.swift @@ -19,7 +19,7 @@ import AWSSDKIdentity /// store any PII securely, such as by using the Keychain! /// /// There are many useful packages available for this purpose that -/// you can find using the [Swift Package +/// you can find using the [Swift Package /// Index](https://swiftpackageindex.com/). @MainActor class ViewModel: ObservableObject { @@ -193,6 +193,10 @@ class ViewModel: ObservableObject { // Save the user's data securely to local storage so it's available // in the future. + // + // IMPORTANT: Any potential Personally Identifiable Information _must_ + // be saved securely, such as by using the Keychain or an appropriate + // encrypting technique. saveUserData() } @@ -234,6 +238,11 @@ class ViewModel: ObservableObject { /// The bucket names are stored in the view model's `bucketList` /// property. func getBucketList() async throws { + // If there's no identity resolver yet, return without doing anything. + guard let identityResolver = identityResolver else { + return + } + // Create an Amazon S3 client configuration that uses the // credential identity resolver created from the JWT token // returned by Sign In With Apple.