Swiftpack.co - Package - icanzilb/TimelaneCombine

TimelaneCombine provides a Combine bindings for profiling Combine code with the Timelane Instrument.

Timelane Instrument

Table of Contens:

Usage

Note: To observe the output of using TimelaneCombine you need to install the Timelane Instrument in advance. More information at: http://timelane.tools.

Import the TimelaneCombine framework in your code:

import TimelaneCombine

Use the lane(_) operator to profile a subscription via the TimelaneInstrument. Insert lane(_) at the precise spot in your code you'd like to profile like so:

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

Then profile your project by clicking Product > Profile in Xcode's main menu.

Select the Timelane Instrument template:

Timelane Instrument Template

Inspect your subscriptions on the timeline:

Timelane Live Recording

For a more detailed walkthrough go to http://timelane.tools.

Reference

lane(_:filter:)

Use lane("Lane name") to send data to both the subscriptions and events lanes in the Timelane Instrument.

lane("Lane name", filter: [.subscriptions]) sends begin/completion events to the Subscriptions lane. Use this syntax if you only want to observe concurrent subscriptions.

lane("Lane name", filter: [.events]) sends events and values to the Events lane. Use this filter if you are only interested in values a subscription would emit (e.g. for example subjects).

Additionally you can transform the values logged in Timelane by using the optional transformValue trailing closure:

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

In case you are using @Published you can easily log that subscription to Timelane by using replacing it with:

@PublishedOnLane("My Lane") var property: String

Installation

Swift Package Manager

I . Automatically in Xcode:

  • Click File > Swift Packages > Add Package Dependency...
  • Use the package URL https://github.com/icanzilb/TimelaneCombine to add TimelaneCombine to your project.

II . Manually in your Package.swift file add:

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

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate TimelaneCombine into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'TimelaneCombine', '~> 2.0'

Demo

The Timelane package contains a demo app at: https://github.com/icanzilb/timelane.

License

Copyright (c) Marin Todorov 2020 This package is provided under the MIT License.

Github

link
Stars: 119

Dependencies

Used By

Total: 0

Releases

TimelaneCombine 2.0.0 -

Small bug fixes and adopts protocol 2

TimelaneCombine 1.0.10 -

TimelaneCombine 1.0.9 -

Upgrades to TimelaneCore 1.0.10

TimelaneCombine 1.0.8 -

Fixes an issue with subscribing a non-shared publisher multiple times (https://github.com/icanzilb/RxTimelane/issues/14)

TimelaneCombine 1.0.7 -

Adds a workaround for the latest Xcode that allows skipping the filter parameter of @PublishedOnLane

Timelane Combine 1.0.6 -

Various bug fixes, including https://github.com/icanzilb/TimelaneCombine/issues/15 which would in certain conditions make a subscription look cancelled when in fact it was completed

TimelaneCombine 1.0.5 -

Version resolving

TimelaneCombine 1.0.4 -

Adds Carthage support

TimelaneCombine 1.0.3 -

Adding support for CocoaPods

TimelaneCombine 1.0.2 -

  • fixes a bug in the merged code in 1.0.1

TimelaneCombine 1.0.1 -

  • includes a lane operator value formatter
  • includes a @PublishedOnLane property wrapper
  • removes redundant imports

TimelaneCombine 1.0 -

TimelaneCombine 1.0

Pre-release.2 -

Pre-release.2

Prerelease.1 -

Pre-release version 1