Faye 2.2.5

Faye 2.2.5

Tommaso BarbugliStream - Nuno 维护。



Faye 2.2.5

  • GetStream 提供

Stream Swift 客户端

Build Status Code Coverage Language: Swift 4.2 Documentation CocoaPods compatible Carthage compatible Swift Package Manager compatible

stream-swift 是用于 Stream 的 Swift 客户端。

您可以在 https://getstream.io/get_started 注册 Stream 账户。

API 文档

API 示例

安装

CocoaPods

对于 Stream,请在您的 Podfile 中添加以下条目

对于 Swift 5

pod 'GetStream', '~> 2.0'

对于 Swift 4.2

pod 'GetStream', '~> 1.0'

然后运行 pod install

在您想要使用 Stream 的任何文件中,别忘了使用 import GetStream 导入框架。

Swift 包管理器

要使用 Apple 的 Swift 包管理器进行集成,请在您的 Package.swift 中添加以下依赖项

.package(url: "https://github.com/GetStream/stream-swift.git", .upToNextMajor(from: "1.0.0"))

Carthage

在您的 Cartfile 中添加以下条目

github "GetStream/stream-swift"

然后运行 carthage update

快速开始

// Setup a shared Stream client.
Client.config = .init(apiKey: "<#ApiKey#>", appId: "<#AppId#>", token: "<#Token#>")

// Setup a Stream current user with the userId from the Token.
Client.shared.createCurrentUser() { _ in 
    // Do all your requests from here. Reload feeds and etc.
}

// Create a user feed.
let userFeed = Client.shared.flatFeed(feedSlug: "user")

// Create an Activity. You can make own Activity class or struct with custom properties.
let activity = Activity(actor: User.current!, verb: "add", object: "picture:10", foreignId: "picture:10")

userFeed?.add(activity) { result in
    // A result of the adding of the activity.
    print(result)
}

// Create a following relationship between "timeline" feed and "user" feed:
let timelineFeed = Client.shared.flatFeed(feedSlug: "timeline")

timelineFeed?.follow(toTarget: userFeed!.feedId, activityCopyLimit: 1) { result in
    print(result)
}

// Read timeline and user's post appears in the feed:
timelineFeed?.get(pagination: .limit(10)) { result in
    let response = try! result.get()
    print(response.results)
}

// Remove an activity by referencing it's foreignId
userFeed?.remove(foreignId: "picture:10") { result in
    print(result)
}

更多API示例 这里

致谢及贡献者

此存储库不再由Stream积极维护。

Feeds集成包括服务器端和客户端代码的组合,接口可以非常不同,因此我们不再专注于支持此SDK。

这绝不是我们维护和改进Feeds API承诺的反映,Feeds API将始终是我们支持的产品。

我们继续欢迎来自社区成员的拉取请求。

版权和许可信息

版权(c)2016-2018 Stream.io Inc,以及个人贡献者。保留所有权利。

请参阅文件 "LICENSE" 了解本软件的历史,使用条款和条件以及所有保证的放弃声明。