Skip to content

Commit 5e7f26f

Browse files
committed
updating package.swift to target 1.0.0 and update readme
1 parent e80097a commit 5e7f26f

File tree

2 files changed

+109
-2
lines changed

2 files changed

+109
-2
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ let package = Package(
278278
.library(name: "XRay", targets: ["XRay"]),
279279
],
280280
dependencies: [
281-
.package(name: "AwsCrt", url: "https://github.com/awslabs/aws-crt-swift", .branch("master")),
282-
.package(name: "ClientRuntime", url: "https://github.com/awslabs/smithy-swift", .branch("master"))
281+
.package(name: "AwsCrt", url: "https://github.com/awslabs/aws-crt-swift.git", from: "1.0.0"),
282+
.package(name: "ClientRuntime", url: "https://github.com/awslabs/smithy-swift.git", from: "1.0.0")
283283
],
284284
targets: [
285285
.target(

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,110 @@ See the local.properties definition above to specify this in a config file.
4949

5050
##### Testing Locally
5151
Testing generated services requires `ClientRuntime` of `smithy-swift` and `AWSClientRuntime` Swift packages.
52+
53+
## Alpha SDK Testing Instructions
54+
*Steps*
55+
56+
1. We have all of the AWS SDKs available in our alpha release listed under `/release` except AWS Locations (coming soon).
57+
58+
We will walk you through how you can use Cognitoidentity as dependency for example in the steps below. To use it, we will create a test project called TestSdk.
59+
60+
```bash
61+
mkdir TestSdk
62+
cd TestSdk
63+
swift package init --type executable
64+
xed .
65+
```
66+
67+
Once Xcode is open, open Package.swift. Update the file to mirror the following. Notice the three following changes:
68+
69+
* Platforms is set to `[.macOS(.v10_15), .iOS(.v13)]`,
70+
* dependencies: - has a .package which references the Cognitoidentity package
71+
* the first target “TestSDK” has a dependency listed as “Cognitoidentity”
72+
73+
```swift
74+
// swift-tools-version:5.4
75+
// The swift-tools-version declares the minimum version of Swift required to build this package.
76+
77+
import PackageDescription
78+
79+
let package = Package(
80+
name: "TestSdk",
81+
platforms: [.macOS(.v10_15), .iOS(.v13)],
82+
dependencies: [
83+
.package(name: "AWSSwiftSDK", url: "https://github.com/awslabs/aws-sdk-swift", from: "1.0.0"),
84+
],
85+
targets: [
86+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
87+
// Targets can depend on other targets in this package, and on products in packages this package depends on.
88+
.target(
89+
name: "TestSdk",
90+
dependencies: [.product(name: "Cognitoidentity", package: "AWSSwiftSDK")]),
91+
.testTarget(
92+
name: "TestSdkTests",
93+
dependencies: ["TestSdk"]),
94+
]
95+
)
96+
```
97+
98+
Update the scheme in Xcode to put your AWS credentials in env variables (we don’t have auto credential resolution quite finished yet, only 3/4 done sry)
99+
100+
Variable names are:*
101+
```
102+
AWS_ACCESS_KEY_ID
103+
AWS_SECRET_ACCESS_KEY
104+
```
105+
(if you need help with getting these values, talk to wooj@ or nickik@
106+
107+
Then you can open up main.swift, and instantiate Cognitoidentity as follows:
108+
109+
```swift
110+
import Cognitoidentity
111+
import Foundation
112+
113+
//this config file will be moved out of the client,
114+
// I realize this is a pain right now and we have an open ticket for it.
115+
let config = try! CognitoidentityClient.CognitoidentityClientConfiguration.default()
116+
let cognitoIdentityClient = CognitoidentityClient(config: config)
117+
let cognitoInputCall = CreateIdentityPoolInput(allowClassicFlow: nil,
118+
allowUnauthenticatedIdentities: true,
119+
cognitoIdentityProviders: nil,
120+
developerProviderName: "com.amazonaws.mytestapplication",
121+
identityPoolName: "identityPoolMadeWithSwiftSDK",
122+
identityPoolTags: nil,
123+
openIdConnectProviderARNs: nil,
124+
samlProviderARNs: nil,
125+
supportedLoginProviders: nil)
126+
127+
cognitoIdentityClient.createIdentityPool(input: cognitoInputCall) { (result) in
128+
switch(result) {
129+
case .success(let output):
130+
print("\(output)")
131+
case .failure(let error):
132+
print("\(error)")
133+
}
134+
}
135+
```
136+
137+
As a result, you should be able to:
138+
139+
1. Log into your AWS console, go to us-east-1 (we default region to us-east-1, no region resolver yet)
140+
2. Click on cognito
141+
3. click on cognito identity pools
142+
4. Verify that you see the newly created identity pool name: identityPoolMadeWithSwiftSDK
143+
144+
145+
If you’ve made it this far... Congrats!🎉
146+
147+
*What’s next?*
148+
Try some other calls? Help us better understand what you think the most critical features are next. Run into any bugs? Give us feedback on the call-site interface. etc...
149+
150+
## Logging
151+
The AWS SDK for Swift uses SwiftLog for high performant logging. Many of our calls are issued to the `debug` level of output, which are disabled in the console by default. To see debug output to your console, you can add the following code to your application in a place where you know that the code will be called once and only once:
152+
```swift
153+
LoggingSystem.bootstrap { label in
154+
var handler = StreamLogHandler.standardOutput(label: label)
155+
handler.logLevel = Logger.Level.debug
156+
return handler
157+
}
158+
```

0 commit comments

Comments
 (0)