https://github.com/sobotics/swiftstack
A Swift wrapper for the Stack Exchange API
https://github.com/sobotics/swiftstack
api-wrapper stackexchange swift
Last synced: 6 months ago
JSON representation
A Swift wrapper for the Stack Exchange API
- Host: GitHub
- URL: https://github.com/sobotics/swiftstack
- Owner: SOBotics
- License: mit
- Created: 2016-12-02T19:38:02.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-08-03T02:05:12.000Z (over 5 years ago)
- Last Synced: 2025-06-08T14:02:48.453Z (6 months ago)
- Topics: api-wrapper, stackexchange, swift
- Language: Swift
- Homepage: http://swiftstack.sobotics.org
- Size: 806 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/SOBotics/SwiftStack)
# About SwiftStack
SwiftStack is a wrapper for the Stack Exchange API written in Swift.
# How to use
To use SwiftStack via Swift Package Manager in your project, add it as dependency in your `Package.swift`.
```
let package = Package(
name: "MyProject",
dependencies: [
.Package(url: "https://github.com/NobodyNada/SwiftStack.git", versions: Version(0,0,0)..`. In this example, `T` is of type `Site`.
Of course, the functions can be more complex, when you want to pass parameters.
### Synchronous request
Synchronous requests return the result as `APIResponse` and `throw` errors. In this example, `T` is of type `Site`.
```
do {
let response = try client.fetchSites()
} catch {
print("An error occurred: \(error)")
}
```
Of course, the functions can be more complex, when you want to pass parameters.
## Returned objects
Every object that contains data of the Stack Exchange API (for example `User`, `Question`,...) has properties with the exact same names as returned by the API, even when those names don't follow Swift conventions.
## Documentation
The documentation can be found here: http://swiftstack.sobotics.org