You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
### Features
6
6
7
-
- Update dependencies to support installation via Swift Package Manager (#1146)
7
+
- Amplify iOS can now be installed via Swift Package Manager. See the [README](https://github.com/aws-amplify/amplify-ios/blob/main/README.md) for full details. (#1146)
Copy file name to clipboardExpand all lines: README.md
+95-8Lines changed: 95 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,11 +41,72 @@ This library is licensed under the Apache 2.0 License.
41
41
42
42
Amplify requires Xcode 11.4 or higher to build.
43
43
44
-
### CocoaPods
45
-
46
44
|:information_source: For more detailed instructions, follow the getting started guides in our [documentation site](https://docs.amplify.aws/lib/q/platform/ios)|
1. Swift Package Manager is distributed with Xcode. To start adding the Amplify Libraries to your iOS project, open your project in Xcode and select **File > Swift Packages > Add Package Dependency**.
1. Enter the Amplify iOS GitHub repo URL (`https://github.com/aws-amplify/amplify-ios`) into the search bar and click **Next**.
54
+
55
+

56
+
57
+
1. You'll see the Amplify iOS repository rules for which version of Amplify you want Swift Package Manager to install. Choose the first rule, **Version**, as it will use the latest compatible version of the dependency that can be detected from the `main` branch, then click **Next**.
58
+
59
+

60
+
61
+
1. Choose which of the libraries you want added to your project. Always select the **Amplify** library. The "Plugin" to install depends on which categories you are using:
62
+
63
+
- API: **AWSAPIPlugin**
64
+
- Analytics: **AWSPinpointAnalyticsPlugin**
65
+
- Auth: **AWSCognitoAuthPlugin**
66
+
- DataStore: **AWSDataStorePlugin**
67
+
- Storage: **AWSS3StoragePlugin**
68
+
69
+
_Note: AWSPredictionsPlugin is not currently supported through Swift Package Manager due to different minimum iOS version requirements. Support for this will eventually be added._
Select all that are appropriate, then click **Finish**.
74
+
75
+
You can always go back and modify which SPM packages are included in your project by opening the Swift Packages tab for your project: Click on the Project file in the Xcode navigator, then click on your project's icon, then select the **Swift Packages** tab.
76
+
77
+
1. In your app code, explicitly import a plugin when you need to add a plugin to Amplify, access plugin options, or access a category escape hatch.
If you're just accessing Amplify category APIs (e.g., `Auth.signIn()` or `Storage.uploadFile()`), you only need to importAmplify:
97
+
98
+
```swift
99
+
importAmplify
100
+
101
+
// ... later
102
+
103
+
funcdoUpload() {
104
+
Amplify.Storage.uploadFile(...)
105
+
}
106
+
```
107
+
108
+
### CocoaPods
109
+
49
110
1. Amplify for iOS is available through [CocoaPods](http://cocoapods.org). If you have not installed CocoaPods, install CocoaPods by running the command:
50
111
```
51
112
$ gem install cocoapods
@@ -59,7 +120,7 @@ Amplify requires Xcode 11.4 or higher to build.
59
120
$ pod setup
60
121
```
61
122
62
-
2. In your project directory (the directory where your `*.xcodeproj` file is), type `pod init` and open the Podfile that was created. Add the `Amplify` pod and any plugins you would like to use. Below is an example of what a podfile might look like if you were going to use the Predictions plugin.
123
+
1. In your project directory (the directory where your `*.xcodeproj` file is), type `pod init` and open the Podfile that was created. Add the `Amplify` pod and any plugins you would like to use. Below is an example of what a podfile might look like if you were going to use the Predictions plugin.
63
124
```ruby
64
125
source 'https://github.com/CocoaPods/Specs.git'
65
126
@@ -74,21 +135,47 @@ Amplify requires Xcode 11.4 or higher to build.
74
135
end
75
136
```
76
137
77
-
3. Then run the following command:
138
+
1. Then run the following command:
78
139
```
79
140
$ pod install
80
141
```
81
-
4. Open up `*.xcworkspace` with Xcode and start using Amplify.
142
+
1. Open up `*.xcworkspace` with Xcode and start using Amplify.
0 commit comments