Files
Peter Zignego c071f10bc8 4.6.0 (#190)
* Generate .xcframework deps, upgrade dep versions

* Don’t use_frameworks! for CocoaPods
2020-10-11 12:10:54 -04:00
..
2020-10-11 12:10:54 -04:00

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())