RxTimelane

Timelane Icon

RxTimelane 提供 RxSwift 绑定,用于使用 Timelane Instrument 分析 RxSwift 代码。

Timelane Instrument

目录

用法

注意: 要观察使用 TimelaneCombine 的输出,您需要提前安装 Timelane Instrument。 更多信息请访问: http://timelane.tools

在您的代码中导入 RxTimelane 框架

import RxTimelane

使用 lane(_) 运算符通过 TimelaneInstrument 分析订阅。 将 lane(_) 插入到您想要分析的代码中的精确位置,如下所示

downloadImage(at: url).
  .lane("Download: \(url.path)")
  .assign(to: \.image, on: myImageView)

然后,通过单击 Xcode 主菜单中的“Product > Profile”来分析您的项目。

选择 Timelane Instrument 模板

Timelane Instrument Template

在时间线上检查您的订阅

Timelane Live Recording

要获得更详细的演练,请访问 http://timelane.tools

API 参考

lane(_:filter:)

使用 lane("Lane name") 将数据发送到 Timelane Instrument 中的订阅和事件通道。

lane("Lane name", filter: [.subscriptions]) 将开始/完成事件发送到订阅通道。 如果您只想观察并发订阅,请使用此语法。

lane("Lane name", filter: [.events]) 将事件和值发送到事件通道。 如果您只对订阅发出的值感兴趣(例如,对于 subjects),请使用此过滤器。

此外,您可以使用可选的 transformValue 尾随闭包来转换 Timelane 中记录的值

lane("Lane name", transformValue: { value in
  return "Value: \(value)"
})

安装

Swift Package Manager

I . 在 Xcode 中自动安装

II . 在您的 Package.swift 文件中手动添加

.package(url: "https://github.com/icanzilb/RxTimelane", from: "2.0.0")

CocoaPods

CocoaPods 是 Cocoa 项目的依赖管理器。 有关用法和安装说明,请访问其网站。 要使用 CocoaPods 将 RxTimelane 集成到您的 Xcode 项目中,请将其添加到您的 Podfile

pod 'RxTimelane', '~> 2.0'

Carthage

不支持。 更多信息

演示

此 repo 包含一个简单的演示应用程序。 要试用它,请打开 RxTimelaneExample/RxTimelane.xcodeproj 并运行“RxTimelaneExample” scheme。

Timelane demo app

许可证

Copyright (c) Marin Todorov 2020 本软件包在 MIT 许可证下提供。