Important
This project is in DEVELOPER PREVIEW while we gather feedback on interfaces and use cases. Please file issues and feature requests. Expect breaking API changes as we incorporate feedback.
The AWS IoT Device SDK for Swift connects your Swift applications and devices to the AWS IoT platform. It handles the complexities of secure communication, authentication, and device management so you can focus on your IoT solution. The SDK makes it easy to use AWS IoT services like Device Shadows, Jobs, and Fleet Provisioning.
Supported Platforms: macOS 12+, iOS 16+, tvOS 16+, Linux
Topics:
The primary purpose of the AWS IoT Device SDK for Swift is to simplify the process of connecting devices to AWS IoT Core and interacting with AWS IoT services on various platforms. The SDK provides:
- Integrated service clients for AWS IoT Core services
- Secure device connections to AWS IoT Core using MQTT protocol including MQTT 5.0
- Support for multiple authentication methods and connection types
- The AWS IoT Device Shadow service manages device state information in the cloud.
- The AWS IoT Jobs service sends remote operations to connected devices.
- The AWS IoT fleet provisioning service generates and delivers device certificates automatically.
Add the AWS IoT Device SDK for Swift package as a dependency to your application.
- Swift 5.10+
If you want to consume the AWS IoT Device SDK package in your Swift package, add it as a dependency in your Package.swift file:
dependencies: [
.package(url: "https://github.com/aws/aws-iot-device-sdk-swift.git")
],
# 1. Create a workspace directory to hold all the SDK files
mkdir sdk-workspace
cd sdk-workspace
# 2. Clone the repository. You can select the version of the SDK you desire to use.
git clone https://github.com/aws/aws-iot-device-sdk-swift.git
cd aws-iot-device-sdk-swift
# 3. Install using swift
swift buildTo get started with the AWS IoT Device SDK for Swift:
-
Add the SDK to your project - See the Installation section for dependency details
-
Choose your connection method - The SDK supports multiple authentication methods including X.509 certificates, AWS credentials, and custom authentication. MQTT5 User Guide provides more guidance
-
Follow a complete example - Check out the Samples directory
-
Learn MQTT5 features - For advanced usage and configuration options, see the MQTT5 User Guide
Check out the Samples directory for working code examples that demonstrate:
- Basic MQTT connection and messaging
- AWS IoT Device Shadow operations
- AWS IoT Jobs
- AWS IoT Fleet provisioning: basic and with CSR
- iOS pub-sub sample application
The samples provide ready-to-run code with detailed setup instructions for each authentication method and use case.
Note: On Mac, after a private key is used with a certificate, that certificate-key pair is imported into the Mac Keychain. All subsequent uses of that certificate will use the stored private key and ignore anything passed in programmatically. When a stored private key from the Mac Keychain is used, the following is logged at the "info" log level:
static: certificate has an existing certificate-key pair that was previously imported into the Keychain.
Using key from Keychain instead of the one provided.
The best way to interact with our team is through GitHub.
- Open discussion: Share ideas and solutions with the SDK community
- Search issues: Find created issues for answers based on a topic
- Create an issue: New feature request or file a bug
If you have a support plan with AWS Support, you can also create a new support case.
Check out our resources for additional guidance too before opening an issue:
- FAQ
- AWS IoT Core Developer Guide
- MQTT5 User Guide
- AWS IoT Core Documentation
- Dev Blog
- Contributions Guidelines
This library is licensed under the Apache 2.0 License.