Swiftpack.co - SoftwareAG/cumulocity-clients-swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by SoftwareAG.
SoftwareAG/cumulocity-clients-swift 1011.0.1
A Swift package to work with Cumuocity IoT, generated using the Cumulocity IoT OpenAPI specification.
⭐️ 4
🕓 3 weeks ago
.package(url: "https://github.com/SoftwareAG/cumulocity-clients-swift.git", from: "1011.0.1")


Working with Xcode

The Swift Package can be opened directly in Xcode. As an alternative, the Package can be also converted into a Xcode project. Open the CumulocityCoreLibrary root directory in your terminal and run the following command:

swift package generate-xcodeproj

or run the shell script located in the root directory:

sh xcodeproj.sh


Configure request information

Additional information can be passed to each API class using the URLRequestBuilder. It provides dedicated methods to configure URL scheme, host name or additional headers:

let builder = URLRequestBuilder()
builder.set(scheme: "http")
builder.set(host: "host")

After configuring use the builder as argument for creating service instances:

let service = SystemOptionsApi(requestBuilder: builder)

Configure URL session

Each API class contains initializers to configure the URLSession used for each request. The session object can be used to register a URLSessionDelegate.

let session = URLSession.shared
let service = SystemOptionsApi(session: session)

Basic Authentication

The client sends HTTP requests with the Authorization header that contains the word Basic followed by a space and a base64-encoded string username:password. To include your credentials in API calls, use the init(requestBuilder: URLRequestBuilder) initializer and pass credentials using URLRequestBuilder as described below:

let builder = URLRequestBuilder()
// configure credentials using the Authorization header
builder.add(header: "Authorization", value: "")
// or pass userName and password explicitly
builder.set(authorization: "userName", password: "password")

These tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.


Stars: 4
Last commit: 6 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics