Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
462 changes: 462 additions & 0 deletions swift/example_code/apple/Buckets/Buckets.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
16 changes: 16 additions & 0 deletions swift/example_code/apple/Buckets/Buckets/Buckets.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
14 changes: 14 additions & 0 deletions swift/example_code/apple/Buckets/Buckets/BucketsApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import SwiftUI

/// The main SwiftUI entry point.
@main
struct BucketsApp: App {
var body: some Scene {
WindowGroup {
ContentView().environmentObject(ViewModel())
}
}
}
64 changes: 64 additions & 0 deletions swift/example_code/apple/Buckets/Buckets/BucketsAppError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import Foundation

/// Represents errors that need to be handled or reported to the user.
enum BucketsAppError: Error, LocalizedError {
/// Sign In With Apple request failed.
case signInWithAppleFailed
/// Sign In With Apple was canceled by the user.
case signInWithAppleCanceled
/// The `AssumeRoleWithWebIdentity` request failed.
case assumeRoleFailed
/// The credentials returned by Sign In With Apple is missing
/// required information.
case credentialsIncomplete
/// The authentication request failed.
case credentialsFailed
/// The `ListBuckets` request did not successfully return a list
/// of Amazon S3 buckets.
case bucketListMissing
/// The token file could not be written to storage.
case tokenFileError(reason: String = "Unable to create the token.")

var errorDescription: String? {
switch self {
case .signInWithAppleFailed:
return "Unable to sign into AWS"
case .signInWithAppleCanceled:
return "Sign in canceled"
case .assumeRoleFailed:
return "Unable to access AWS S3"
case .credentialsIncomplete:
return "Unable to authenticate"
case .credentialsFailed:
return "Invalid web token"
case .bucketListMissing:
return "Unable to access AWS S3"
case .tokenFileError:
return "Token error"
}
}

/// A human-readable error message string corresponding to the
/// error returned.
var recoverySuggestion: String? {
switch self {
case .signInWithAppleFailed:
return "Sign In With Apple returned an error."
case .signInWithAppleCanceled:
return "User did not authenticate."
case .assumeRoleFailed:
return "The role could not be assumed using the web token returned by Sign In With Apple."
case .credentialsIncomplete:
return "The credentials returned by AssumeRoleWithWebIdentity are incomplete."
case .credentialsFailed:
return "An error occurred while attempting to retrieve credentials from AWS."
case .bucketListMissing:
return "Amazon S3 did not return a valid bucket list."
case .tokenFileError(let reason):
return "An error occurred with the local Sign In With Apple token: \(reason)"
}
}
}
Loading
Loading