Skip to content

Commit 5d7e0ea

Browse files
shepazonrlhagerm
authored andcommitted
Updates suggested by Sebastien.
1 parent c319089 commit 5d7e0ea

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

swift/example_code/apple/Buckets/Buckets/ContentView-ViewModel.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import AWSSDKIdentity
1919
/// store any PII securely, such as by using the Keychain!
2020
///
2121
/// There are many useful packages available for this purpose that
22-
/// you can find using the [Swift Package
22+
/// you can find using the [Swift Package
2323
/// Index](https://swiftpackageindex.com/).
2424
@MainActor
2525
class ViewModel: ObservableObject {
@@ -193,6 +193,10 @@ class ViewModel: ObservableObject {
193193

194194
// Save the user's data securely to local storage so it's available
195195
// in the future.
196+
//
197+
// IMPORTANT: Any potential Personally Identifiable Information _must_
198+
// be saved securely, such as by using the Keychain or an appropriate
199+
// encrypting technique.
196200

197201
saveUserData()
198202
}
@@ -234,6 +238,11 @@ class ViewModel: ObservableObject {
234238
/// The bucket names are stored in the view model's `bucketList`
235239
/// property.
236240
func getBucketList() async throws {
241+
// If there's no identity resolver yet, return without doing anything.
242+
guard let identityResolver = identityResolver else {
243+
return
244+
}
245+
237246
// Create an Amazon S3 client configuration that uses the
238247
// credential identity resolver created from the JWT token
239248
// returned by Sign In With Apple.

0 commit comments

Comments
 (0)