Skip to content
This repository was archived by the owner on Dec 2, 2022. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

SKClient

Create a custom SlackKit client.

Installation

Swift Package Manager Add SlackKit as a dependency to your Package.swift and specify SKClient as a target dependency:
import PackageDescription
  
let package = Package(
    name: "SampleApp",
    products: [
        .executable(
            name: "SampleApp",
            targets: ["SampleApp"]),
    ],
    dependencies: [
        .package(url: "https://github.com/pvzig/SlackKit.git", .upToNextMinor(from: "4.6.0")),
    ],
    targets: [
        .target(
            name: "SampleApp",
            dependencies: ["SKClient"])
    ]
)
Carthage Add SlackKit to your Cartfile:
github "pvzig/SlackKit"

and run

carthage bootstrap

Drag the built SKClient.framework and it's dependency SKCore.framework into your Xcode project.

CocoaPods Add SKClient to your Podfile:
use_frameworks!
pod 'SlackKit/SKClient'

Usage

To use the library in your project import it:

Carthage & SPM

import SKClient

CocoaPods

import SlackKit

The Basics

Subclass Client to create a custom SlackKit client.

class MyClient: Client {

    override func notificationForEvent(_ event: Event, type: EventType) {
    …
    }

	override func initialSetup(JSON: [String: Any]) {
	…
	}
}

Pass your custom client to SlackKit when adding an RTM bot:

let bot = SlackKit()
bot.addRTMBotWithAPIToken(“xoxb-SLACK_AUTH_TOKEN”, client: MyClient())