A pure Swift interpretation of the Cosmic JavaScript SDK for use in Swift and SwiftUI projects.
The CosmicSDKSwift is a pure Swift interpretation of the Cosmic SDK, designed for use in Swift and SwiftUI projects. Inspired by the JavaScript SDK and Adam Rushy's OpenAISwift, this project aims to provide a smart SDK that closely mirrors the functionality of the JavaScript SDK while adhering to common Swift conventions. Cosmic is a headless CMS (content management system) that offers a web dashboard for creating content and an API toolkit for delivering content to websites and applications. The SDK allows users to create their own state to hold results, map variables to arrays of objects, and perform various operations such as finding, inserting, updating, and deleting objects.
insertOne() method allows users to add a new object to their Cosmic Bucket.updateOne() method enables users to update an object's metadata by providing a metadata dictionary with key-value pairs.To use the SDK, refer to the JavaScript implementation for a complete list of available methods. Note that the Swift version may not be at feature parity or feature complete. However, the following methods are currently available:
find() method with optional parameters such as props, limit, sorting, and status to retrieve objects.insertOne() method adds a new object to your Cosmic Bucket. Use it for adding an object to an existing object type.updateOne(), users can update an object's metadata by passing an optional metadata dictionary with key-value pairs for title, content, metadata, and status.The CosmicSDKSwift is a pure Swift SDK that provides functionality for integrating Cosmic, a headless CMS, into Swift and SwiftUI projects. Through the SDK, users can perform various operations such as finding, inserting, updating, and deleting objects within their Cosmic Buckets. The SDK can be easily integrated using the Swift Package Manager, and API access keys can be obtained from the Cosmic dashboard. While the Swift version may not be fully feature complete, it offers key features such as finding objects with optional parameters, inserting and updating objects, and deleting objects with the required "id" parameter.
Cosmic is a headless CMS that enables developers to build websites and applications using any tech stack. It features a user-friendly dashboard for managing content, powerful API for retrieving data, and easy integration with popular frontend frameworks and tools.