https://github.com/zulip/swift-zulip-api
A Zulip library written in Swift.
https://github.com/zulip/swift-zulip-api
swift zulip
Last synced: 9 months ago
JSON representation
A Zulip library written in Swift.
- Host: GitHub
- URL: https://github.com/zulip/swift-zulip-api
- Owner: zulip
- License: mit
- Created: 2018-04-09T01:20:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-13T12:08:09.000Z (almost 4 years ago)
- Last Synced: 2025-09-23T22:26:06.609Z (9 months ago)
- Topics: swift, zulip
- Language: Swift
- Homepage:
- Size: 144 KB
- Stars: 18
- Watchers: 5
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# `swift-zulip-api`

[](https://travis-ci.com/github/zulip/swift-zulip-api)
[](https://github.com/zulip/swift-zulip-api)
[](https://swift.org)
A library to access the Zulip API with **Swift**.
## Installation
### Swift Package Manager
`swift-zulip-api` can be installed with the
[Swift Package Manager](https://is.gd/aRdTkN).
In your `dependencies`, add
[`https://github.com/zulip/swift-zulip-api.git`](https://is.gd/SQQWRT):
```swift
dependencies: [
.package(
url: "https://github.com/zulip/swift-zulip-api.git",
from: "0.3.0"
)
]
```
### CocoaPods
`swift-zulip-api` can also be installed with [CocoaPods](https://is.gd/iMgFFg).
In your `Podfile`, add `swift-zulip-api`.
```ruby
pod 'swift-zulip-api'
```
Then run `pod install` from the terminal.
```bash
pod install
```
## Usage
### Set-up
```swift
import SwiftZulipAPI
// Set up a Zulip configuration.
let config = Config(
emailAddress: "email@example.com",
apiKey: "yourapikey",
realmURL: "https://example.com"
)
// Create the Zulip client.
let zulip = Zulip(config: config)
```
### Functions
`swift-zulip-api` is split into a few different namespaces, each with their own
functions:
**messages:**
```swift
let messages = zulip.messages()
```
[See the full `messages` docs.](https://github.com/zulip/swift-zulip-api/blob/master/docs/messages.md)
**streams:**
```swift
let streams = zulip.streams()
```
[See the full `streams` docs.](https://github.com/zulip/swift-zulip-api/blob/master/docs/streams.md)
**users:**
```swift
let users = zulip.users()
```
[See the full `users` docs.](https://github.com/zulip/swift-zulip-api/blob/master/docs/users.md)
**events:**
```swift
let events = zulip.events()
```
[See the full `events` docs.](https://github.com/zulip/swift-zulip-api/blob/master/docs/events.md)
### Examples
Each of the function docs has examples for how to use the functions. There is
also a [full Swift example file](https://github.com/zulip/swift-zulip-api/blob/master/example/SwiftZulipAPIExample/main.swift)
if you want to see every function being used in an actual example program.
The example can be run by using
```bash
swift run SwiftZulipAPIExample
```
from the terminal.
### Bots
`swift-zulip-api` supports writing Bots to automatically respond to users. Each
bot will respond when it is mentioned in a message.
[See the full bots docs.](https://github.com/zulip/swift-zulip-api/blob/master/docs/bots.md)