A Swift client for Lemmy.
- Fully Swift type safe
async
/await
compatible- Supports all Lemmy API endpoints
- Uses Codable for easy JSON serialization/deserialization
We use Swift Package Manager to make it easy to install and use the Lemmy Swift Client in your project.
dependencies: [
.package(url: "https://github.com/rrainn/Lemmy-Swift-Client.git", .upToNextMajor(from: "1.0.0"))
]
Below is an example of a basic usage example of how to use the Lemmy Swift Client.
import Lemmy_Swift_Client
if let url = URL(string: "https://eventfrontier.com/api/v3") {
// Create an instance of the Lemmy API with the base URL of your Lemmy instance
let api = LemmyAPI(baseUrl: url)
// Create a SearchRequest object with the `q` parameter
let request = SearchRequest(q: "Lemmy-Swift-Client")
// Send the request to the Lemmy API
if let response = try? await api.request(request) {
print(response)
} else {
print("Error")
}
}
Luckily this just scratches the surface of what you can do with the Lemmy Swift Client. For more information checkout our documentation.
Lemmy Swift Client is available under the MIT license. See the LICENSE.