Skip to content

Commit 5b7abfd

Browse files
Rohan Dubalscb01
authored andcommitted
Initial changes for documentation using mkdocs. Added Service Clients usage and S3TransferUtility usage.
1 parent 6ab2982 commit 5b7abfd

17 files changed

+932
-0
lines changed

Scripts/APIReference.sh

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/bin/sh
2+
set -x
3+
4+
# remove everything generated by this script
5+
function cleanup
6+
{
7+
rm -rf docs/reference
8+
rm -rf Documentation
9+
rm -rf docs_tmp
10+
}
11+
12+
13+
VERSION="2.6.22"
14+
if [ -n $1 ] && [ "$1" == "clean" ];
15+
then
16+
cleanup
17+
exit 0
18+
else
19+
cd "$SOURCE_ROOT"
20+
21+
if [ -d docs/reference ];
22+
then
23+
cleanup
24+
fi
25+
26+
rm -rf docs_tmp
27+
mkdir -p docs_tmp
28+
29+
cp -r AWSAPIGateway ./docs_tmp/AWSAPIGateway
30+
cp -r AWSAutoScaling ./docs_tmp/AWSAutoScaling
31+
cp -r AWSCore ./docs_tmp/AWSCore
32+
cp -r AWSCognito ./docs_tmp/AWSCognito
33+
cp -r AWSCognitoIdentityProvider ./docs_tmp/AWSCognitoIdentityProvider
34+
cp -r AWSCloudWatch ./docs_tmp/AWSCloudWatch
35+
cp -r AWSDynamoDB ./docs_tmp/AWSDynamoDB
36+
cp -r AWSElasticLoadBalancing ./docs_tmp/AWSElasticLoadBalancing
37+
cp -r AWSIoT ./docs_tmp/AWSIoT
38+
cp -r AWSKinesis ./docs_tmp/AWSKinesis
39+
cp -r AWSKMS ./docs_tmp/AWSKMS
40+
cp -r AWSLambda ./docs_tmp/AWSLambda
41+
cp -r AWSLex ./docs_tmp/AWSLex
42+
cp -r AWSLogs ./docs_tmp/AWSLogs
43+
cp -r AWSMachineLearning ./docs_tmp/AWSMachineLearning
44+
cp -r AWSMobileAnalytics ./docs_tmp/AWSMobileAnalytics
45+
cp -r AWSPinpoint ./docs_tmp/AWSPinpoint
46+
cp -r AWSPolly ./docs_tmp/AWSPolly
47+
cp -r AWSRekognition ./docs_tmp/AWSRekognition
48+
cp -r AWSS3 ./docs_tmp/AWSS3
49+
cp -r AWSSES ./docs_tmp/AWSSES
50+
cp -r AWSSimpleDB ./docs_tmp/AWSSimpleDB
51+
cp -r AWSSNS ./docs_tmp/AWSSNS
52+
cp -r AWSSQS ./docs_tmp/AWSSQS
53+
cp -r AWSTranscribe ./docs_tmp/AWSTranscribe
54+
cp -r AWSTranslate ./docs_tmp/AWSTranslate
55+
cp -r AWSComprehend ./docs_tmp/AWSComprehend
56+
cp -r AWSCognitoAuth ./docs_tmp/AWSCognitoAuth
57+
cp -r AWSAuthSDK/Sources/AWSAuthCore ./docs_tmp/AWSAuthSDK/
58+
cp -r AWSAuthSDK/Sources/AWSAuthUI ./docs_tmp/AWSAuthSDK/
59+
cp -r AWSAuthSDK/Sources/AWSFacebookSignIn ./docs_tmp/AWSAuthSDK/
60+
cp -r AWSAuthSDK/Sources/AWSGoogleSignIn ./docs_tmp/AWSAuthSDK/
61+
cp -r AWSAuthSDK/Sources/AWSUserPoolsSignIn ./docs_tmp/AWSAuthSDK/
62+
cp -r AWSAuthSDK/Sources/AWSAuthUI ./docs_tmp/AWSAuthSDK/
63+
cp -r AWSAuthSDK/Sources/AWSMobileClient ./docs_tmp/AWSAuthSDK/
64+
65+
rm -rf ./docs_tmp/AWSCore/Bolts
66+
rm -rf ./docs_tmp/AWSCore/Fabric
67+
rm -rf ./docs_tmp/AWSCore/FMDB
68+
rm -rf ./docs_tmp/AWSCore/GZIP
69+
rm -rf ./docs_tmp/AWSCore/Logging
70+
rm -rf ./docs_tmp/AWSCore/Mantle
71+
rm -rf ./docs_tmp/AWSCore/Reachability
72+
rm -rf ./docs_tmp/AWSCore/TMCache
73+
rm -rf ./docs_tmp/AWSCore/UICKeyChainStore
74+
rm -rf ./docs_tmp/AWSCore/XMLDictionary
75+
rm -rf ./docs_tmp/AWSCore/XMLWriter
76+
rm -rf ./docs_tmp/AWSCognito/Internal
77+
rm -rf ./docs_tmp/AWSCognito/Fabric
78+
rm -rf ./docs_tmp/AWSCognitoIdentityProvider/Internal
79+
rm -rf ./docs_tmp/AWSCognitoAuth/Internal
80+
rm -rf ./docs_tmp/AWSMobileAnalytics/Internal
81+
rm -rf ./docs_tmp/AWSIoT/Internal
82+
rm -rf ./docs_tmp/AWSLex/Bluefront
83+
rm -rf ./docs_tmp/AWSAuthSDK/UserPoolsUI
84+
85+
cd docs_tmp
86+
87+
# generate documenation
88+
appledoc --verbose 1 \
89+
--output ../docs/reference \
90+
--exit-threshold 2 \
91+
--no-repeat-first-par \
92+
--explicit-crossref \
93+
--company-id aws.amazon.com \
94+
--project-name "AWS Mobile SDK for iOS v${VERSION}" \
95+
--project-version "${VERSION}" \
96+
--project-company "Amazon Web Services, Inc." \
97+
--create-html \
98+
--keep-intermediate-files \
99+
--index-desc ../aws-sdk-for-ios.markdown \
100+
./
101+
102+
# get command execution result
103+
result=$?
104+
105+
if [ $result != 0 ];
106+
then
107+
echo "Building the AWS Mobile SDK for iOS documentation FAILED!"
108+
cleanup;
109+
exit 1;
110+
fi
111+
112+
exit 0
113+
fi

Scripts/DocsCleanup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
rm -rf docs/reference/docset/
2+
rm docs/reference/docset-installed.txt
3+
cp -r docs/reference/html/ docs/docs/reference
4+
rm -rf docs/reference

docs/awstask.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
With native AWSTask support in the SDK for iOS, you can chain async requests instead of nesting them. It makes the logic cleaner, while keeping the code more readable. Read [Working with AWSTask](http://docs.aws.amazon.com/mobile/sdkforios/developerguide/awstask.html) to learn how to use AWSTask.

docs/index.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# AWS Mobile SDK for iOS
2+
3+
[![Release](https://img.shields.io/github/release/aws/aws-sdk-ios.svg)]()
4+
[![CocoaPods](https://img.shields.io/cocoapods/v/AWSiOSSDKv2.svg)]()
5+
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
6+
[![Twitter Follow](https://img.shields.io/twitter/follow/AWSforMobile.svg?style=social&label=Follow)](https://twitter.com/AWSforMobile)
7+
8+
## Introduction
9+
10+
AWS Mobile SDK for iOS offers a set of SDKs which make working with AWS easy. You could leverage services like `S3`, `AppSync`, `IoT`, `CognitoUserPools`, `DynamoDB`, and many other in your application with very few steps. We also provide utility clients like `S3TransferUtility`, `Auth`, `DynamoDB`, etc. which further simplify interaction with the cloud!
11+
12+
## Quick Links
13+
14+
* [API Reference](http://aws.github.io/aws-sdk-ios/docs/reference)
15+
* [Source Code on Github](https://github.com/aws/aws-sdk-ios)
16+
17+
## Setting Up
18+
19+
???+info "Setup Requirements"
20+
To use the AWS SDK for iOS, you will need the following installed on your development machine:
21+
22+
* Xcode 8 or later
23+
* iOS Simulators / iPhones with iOS 9 or later
24+
25+
To get started with AWS Mobile SDK for iOS, follow __**[this link](setup/setup-dependencies.md)**__ to setup the dependencies and integrate them in your application.
26+
27+
???- tip "SDK Samples"
28+
The [samples](https://github.com/awslabs/aws-sdk-ios-samples) included with the SDK for iOS are standalone projects that are already set up for you. You can also integrate the SDK for iOS with your own existing project.
29+
30+
## Talk to Us
31+
32+
Visit our [GitHub Page](https://github.com/aws/aws-sdk-ios) to leave feedback and to connect with other users of the SDK.
33+
34+
## Author
35+
36+
Amazon Web Services
37+
38+
## License
39+
40+
See the **LICENSE** file for more info.

docs/logging.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
As of version 2.5.4 of this SDK, logging utilizes [CocoaLumberjack](https://github.com/CocoaLumberjack/CocoaLumberjack), a flexible, fast, open source logging framework. It supports many capabilities including the ability to set logging level per output target, for instance, concise messages logged to the console and verbose messages to a log file.
2+
3+
CocoaLumberjack logging levels are additive such that when the level is set to verbose, all messages from the levels below verbose are logged. It is also possible to set custom logging to meet your needs. For more information, see [CocoaLumberjack](https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/Documentation/CustomLogLevels.md)
4+
5+
## Changing Log Levels
6+
7+
```swift tab="Swift"
8+
AWSDDLog.sharedInstance.logLevel = .verbose
9+
```
10+
11+
```objective-c tab="Objective-C"
12+
[AWSDDLog sharedInstance].logLevel = AWSDDLogLevelVerbose;
13+
```
14+
15+
The following logging level options are available:
16+
17+
```swift tab="Swift"
18+
.off
19+
.error
20+
.warning
21+
.info
22+
.debug
23+
.verbose
24+
```
25+
26+
```objective-c tab="Objective-C"
27+
AWSDDLogLevelOff
28+
AWSDDLogLevelError
29+
AWSDDLogLevelWarning
30+
AWSDDLogLevelInfo
31+
AWSDDLogLevelDebug
32+
AWSDDLogLevelVerbose
33+
```
34+
35+
We recommend setting the log level to `Off` before publishing to the Apple App Store.
36+
37+
## Targeting Log Output
38+
39+
CocoaLumberjack can direct logs to file or used as a framework that integrates with the Xcode console.
40+
41+
To initialize logging to files, use the following code:
42+
43+
```swift tab="Swift"
44+
let fileLogger: AWSDDFileLogger = AWSDDFileLogger() // File Logger
45+
fileLogger.rollingFrequency = TimeInterval(60*60*24) // 24 hours
46+
fileLogger.logFileManager.maximumNumberOfLogFiles = 7
47+
AWSDDLog.add(fileLogger)
48+
```
49+
50+
```objective-c tab="Objective-C"
51+
AWSDDFileLogger *fileLogger = [[AWSDDFileLogger alloc] init]; // File Logger
52+
fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
53+
fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
54+
[AWSDDLog addLogger:fileLogger];
55+
```
56+
57+
To initialize logging to your Xcode console, use the following code:
58+
59+
```swift tab="Swift"
60+
AWSDDLog.add(AWSDDTTYLogger.sharedInstance) // TTY = Xcode console
61+
```
62+
63+
```objective-c tab="Objective-C"
64+
[AWSDDLog addLogger:[AWSDDTTYLogger sharedInstance]]; // TTY = Xcode console
65+
```
46.1 KB
Loading
40.4 KB
Loading
41.4 KB
Loading

docs/s3/s3-downloads.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
You can use `AWSS3TransferUtility` to download your data from `Amazon S3`. It internally uses `NSURLSession` to facilitate that the downloads continue even when the app goes into background.
2+
3+
## Download raw data
4+
5+
You can pass in a `Data` object to the `uploadUsingMultiPart` API to upload data which will be store in `S3`.
6+
7+
```swift linenums="2"
8+
9+
// Fetch the transfer utility client
10+
let transferUtility = AWSS3TransferUtility.default()
11+
12+
// Initialize the completion handler which will be called when the upload completes
13+
var completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock?
14+
15+
completionHandler = { (task, location, data, error) -> Void in
16+
DispatchQueue.main.async(execute: {
17+
if let error = error {
18+
// Handle error here. Indicates download failed.
19+
} else {
20+
// `data` object contains the downloaded data
21+
}
22+
})
23+
}
24+
25+
// The download task contains information about your download and can be used for activities like pause, resume, cancel.
26+
let downloadTask = transferUtility.downloadData(
27+
fromBucket: "YourBucket",
28+
key: "YourFileName",
29+
expression: nil,
30+
completionHandler: completionHandler)
31+
```
32+
33+
## Download to File
34+
35+
```swift linenums="2"
36+
37+
// Fetch the transfer utility client
38+
let transferUtility = AWSS3TransferUtility.default()
39+
40+
// Initialize the completion handler which will be called when the upload completes
41+
var completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock?
42+
43+
completionHandler = { (task, location, data, error) -> Void in
44+
DispatchQueue.main.async(execute: {
45+
if let error = error {
46+
// Handle error here. Indicates download failed.
47+
} else {
48+
// `location` object contains the location of downloaded data
49+
}
50+
})
51+
}
52+
53+
// Determine the file location where you want the download to happen
54+
let downloadLocation: URL = URL(....)
55+
56+
// The download task contains information about your download and can be used for activities like pause, resume, cancel.
57+
let downloadTask = transferUtility.download(to: downloadLocation
58+
fromBucket: "YourBucket",
59+
key: "YourFileName",
60+
expression: nil,
61+
completionHandler: completionHandler)
62+
```
63+
64+
## Progress Tracking
65+
66+
To enable progress tracking, we will use the `expression` parameter in the `download` API call as highlighted below. We will update the example above to include progress tracking.
67+
68+
```swift hl_lines="4 5 6 7 8 9 10 32" linenums="2"
69+
70+
// Fetch the transfer utility client
71+
let transferUtility = AWSS3TransferUtility.default()
72+
73+
// Create progress tracking expression
74+
let expression = AWSS3TransferUtilityDownloadExpression()
75+
expression.progressBlock = {(task, progress) in
76+
DispatchQueue.main.async(execute: {
77+
// Do something e.g. Update a progress bar.
78+
})
79+
}
80+
81+
// Initialize the completion handler which will be called when the upload completes
82+
var completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock?
83+
84+
completionHandler = { (task, location, data, error) -> Void in
85+
DispatchQueue.main.async(execute: {
86+
if let error = error {
87+
// Handle error here. Indicates download failed.
88+
} else {
89+
// `location` object contains the location of downloaded data
90+
}
91+
})
92+
}
93+
94+
// Determine the file location where you want the download to happen
95+
let downloadLocation: URL = URL(....)
96+
97+
// The download task contains information about your download and can be used for activities like pause, resume, cancel.
98+
let downloadTask = transferUtility.download(to: downloadLocation
99+
fromBucket: "YourBucket",
100+
key: "YourFileName",
101+
expression: expression,
102+
completionHandler: completionHandler)
103+
```
104+
105+
## Pause / Resume / Cancel
106+
107+
We use the `downloadTask` object which we get back from the `download` call to perform the pause, resume and cancel operations.
108+
109+
### Pause
110+
111+
downloadTask.suspend()
112+
113+
### Resume
114+
115+
downloadTask.resume()
116+
117+
### Cancel
118+
119+
downloadTask.cancel()

0 commit comments

Comments
 (0)