{"id":30719845,"url":"https://github.com/dankinsoid/combineoperators","last_synced_at":"2025-09-03T10:42:25.539Z","repository":{"id":42058592,"uuid":"342244030","full_name":"dankinsoid/CombineOperators","owner":"dankinsoid","description":"Combine operators","archived":false,"fork":false,"pushed_at":"2022-11-15T06:50:03.000Z","size":236,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-03T10:41:55.129Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dankinsoid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-25T12:53:38.000Z","updated_at":"2023-05-30T08:23:41.000Z","dependencies_parsed_at":"2022-08-12T03:40:28.503Z","dependency_job_id":null,"html_url":"https://github.com/dankinsoid/CombineOperators","commit_stats":null,"previous_names":[],"tags_count":90,"template":false,"template_full_name":null,"purl":"pkg:github/dankinsoid/CombineOperators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FCombineOperators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FCombineOperators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FCombineOperators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FCombineOperators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dankinsoid","download_url":"https://codeload.github.com/dankinsoid/CombineOperators/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FCombineOperators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273431361,"owners_count":25104491,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-03T10:42:24.638Z","updated_at":"2025-09-03T10:42:25.517Z","avatar_url":"https://github.com/dankinsoid.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CombineOperators\n[![CI Status](https://img.shields.io/travis/Voidilov/CombineOperators.svg?style=flat)](https://travis-ci.org/Voidilov/CombineOperators)\n[![Version](https://img.shields.io/cocoapods/v/CombineOperators.svg?style=flat)](https://cocoapods.org/pods/CombineOperators)\n[![License](https://img.shields.io/cocoapods/l/CombineOperators.svg?style=flat)](https://cocoapods.org/pods/CombineOperators)\n[![Platform](https://img.shields.io/cocoapods/p/CombineOperators.svg?style=flat)](https://cocoapods.org/pods/CombineOperators)\n\n## Description\n\nThis repo includes operators for Combine, almost complete re-implementation of CombineCocoa, RxViewController, RxGestures and RxKeyboard libraries and some additional features.\n\nExample\n\n```swift\nimport UIKit\nimport Combine\nimport CombineCocoa\nimport CombineOperators\n\nfinal class SomeViewModel {\n  let title = CurrentValueSubject\u003cString, Never\u003e(\"Title\")\n  let icon = CurrentValueSubject\u003cUIImage?, Never\u003e(nil)\n  let color = CurrentValueSubject\u003cUIColor, Never\u003e(UIColor.white)\n  let bool = CurrentValueSubject\u003cBool, Never\u003e(false)\n  ...\n} \n\nclass ViewController: UIViewController {\n\n  @IBOutlet private weak var titleLabel: UILabel!\n  @IBOutlet private weak var iconView: UIImageView!\n  @IBOutlet private weak var switchView: UISwitch!\n\n  let viewModel = SomeViewModel()\n  ...\n  private func configureSubscriptions() {\n    viewModel.title ==\u003e titleLabel.cb.text\n    viewModel.iconView ==\u003e iconView.cb.image\n    viewModel.bool ==\u003e switchView.cb.isOn\n    viewModel.color ==\u003e (self, ViewController.setTint)\n    //or viewModel.color ==\u003e cb.weak(method: ViewController.setTint)\n    //or viewModel.color ==\u003e {[weak self] in self?.setTint(color: $0) }\n  }\n\n  private func setTint(color: UIColor) {\n  ...\n  } \n  ...\n}\n```\n\n## Usage\n\n1. Operator `=\u003e` \n\n- From `Publisher` to `Subscriber`, creates a subscription:\n  \n  ```swift\n  intPublisher =\u003e intSubscriber\n```\n\n- From `Publisher` to `Subject`, creates a subscription and returns `Cancellable`:\n\n```swift\n  let Cancellable = intPublisher =\u003e intSubject\n  ```\n\n  - From `Cancellable` to `DisposeBag`:\n  \n  ```swift\n  someCancellable =\u003e cancellableSet\n  somePublisher =\u003e someSubject =\u003e cancellableSet\n  ```\n  \n  - From `Publisher` to `Scheduler`, returns `AnyPublisher\u003cOutput, Failure\u003e`:\n  \n  ```swift\n  somePublisher =\u003e DispatchQueue.main =\u003e someSubscriber\n  ```\n  \n  - From `Publisher` to `(Output) -\u003e Void`:\n  \n  ```swift\n  somePublisher =\u003e { print($0) }\n  ```\n  \n  - From `Publisher` to `@autoescaping () -\u003e Void`:\n  \n  ```swift\n  somePublisher =\u003e print(\"action\")\n  ```\n  All operators casts output-input types and errors types where possible\n  \n2. Operator `==\u003e`\n  \nDrive `Publisher` to `Subscriber` on main queue:\n```swift\nintPublisher ==\u003e intSubscriber =\u003e cancellableSet\n```\n\n3. Operators `=\u003e\u003e` and `==\u003e\u003e` replaces `.removeDublicates()`\n\n4. `CancellableBuilder` and `MergeBuilder`, `CombineLatestBuilder` - result builders\n\n5. Some features:\n- `UIView.cb` operators: `isVisible`, `willAppear`, `isOnScreen`, `didAppear`, `movedToWindow`, `frame`, `frameOnWindow`, etc. \n- `skipNil()` operator\n- `or(Bool), .toggle(), !` operators for boolean sequences\n- use `+` and `+=` operator for merging publishers, creating Cancellables, etc\n- `interval(...)` \n- `withLast() -\u003e AnyPublisher\u003c(previous: Output?, current: Output), Failure\u003e`\n- `.mp` - `@dynamicMemberLookup` mapper\n- `asResult() -\u003e AnyPublisher\u003cResult\u003cOutput, Failure\u003e, Never\u003e`\n- `nilIfEmpty`\n- `isEmpty`\n- `isNil`\n- `isNilOrEmpty`\n- `append(...)`\n- `smooth(...)` methods to smooth changes, example: sequence`[0, 1]` turns to `[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]`\n- `onValue, onFailure, onFinished, onSubscribe, onCancel, onRequest` wrappers on `handleEvents(...)` operator\n- `guard()`\n- `cb.isFirstResponder`\n- `UIStackView().cb.update(...)`\n- `UIView().cb.transform.scale(), .rotation(), .translation()`\n\n## Installation\n\n1.  [CocoaPods](https://cocoapods.org)\n\nCombineOperators is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n```ruby\npod 'CombineOperators/CombineCocoa'\n```\nand run `pod update` from the podfile directory first.\n\n2. [Swift Package Manager](https://github.com/apple/swift-package-manager)\n\nCreate a `Package.swift` file.\n```swift\n// swift-tools-version:5.0\nimport PackageDescription\n\nlet package = Package(\n  name: \"SomeProject\",\n  dependencies: [\n    .package(url: \"https://github.com/dankinsoid/CombineOperators.git\", from: \"1.81.0\")\n    ],\n  targets: [\n    .target(name: \"SomeProject\", dependencies: [\"CombineOperators\"])\n    ]\n)\n```\n```ruby\n$ swift build\n```\n## Author\n\nVoidilov, voidilov@gmail.com\n\n## License\n\nCombineOperators is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdankinsoid%2Fcombineoperators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdankinsoid%2Fcombineoperators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdankinsoid%2Fcombineoperators/lists"}