All Projects → tcldr → Entwine

tcldr / Entwine

Licence: mit
Testing tools and utilities for Apple's Combine framework.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Entwine

Conbini
Publishers, operators, and subscribers to supplement Combine.
Stars: ✭ 109 (-64.38%)
Mutual labels:  apple, reactive-programming, tvos, xctest
Awesome Reactive Programming
A repository for sharing all the resources available on Reactive Programming and Reactive Systems
Stars: ✭ 163 (-46.73%)
Mutual labels:  reactive, reactive-programming, reactive-streams
Reactive Ms Example
An educational project to learn reactive programming with Spring 5
Stars: ✭ 157 (-48.69%)
Mutual labels:  reactive, reactive-programming, reactive-streams
Rxswift To Combine Cheatsheet
RxSwift to Apple’s Combine Cheat Sheet
Stars: ✭ 1,040 (+239.87%)
Mutual labels:  apple, reactive, reactive-programming
Rxcombine
Bi-directional type bridging between RxSwift and Apple's Combine framework
Stars: ✭ 741 (+142.16%)
Mutual labels:  reactive, reactive-programming, reactive-streams
Rsocket Rpc Java
Standard RSocket RPC Java Implementation
Stars: ✭ 126 (-58.82%)
Mutual labels:  reactive, reactive-programming, reactive-streams
Open Source Ios Apps
📱 Collaborative List of Open-Source iOS Apps
Stars: ✭ 28,826 (+9320.26%)
Mutual labels:  apple, reactive-programming, tvos
Rxdownloader
- Reactive Extension Library for Android to download files
Stars: ✭ 40 (-86.93%)
Mutual labels:  reactive, reactive-programming, reactive-streams
netifi-quickstart-java
Project to assist you in getting started using Netifi.
Stars: ✭ 23 (-92.48%)
Mutual labels:  reactive, reactive-streams, reactive-programming
springboot-rsocketjwt-example
Example of using JWT with RSocket and Spring Boot
Stars: ✭ 26 (-91.5%)
Mutual labels:  reactive, reactive-streams, reactive-programming
KotlinReactiveMS
An educational project to learn reactive programming with Spring 5 and Kotlin
Stars: ✭ 33 (-89.22%)
Mutual labels:  reactive, reactive-streams, reactive-programming
Rxjava2 Jdbc
RxJava2 integration with JDBC including Non-blocking Connection Pools
Stars: ✭ 360 (+17.65%)
Mutual labels:  reactive, reactive-programming, reactive-streams
Reactor Addons
Official modules for the Reactor project
Stars: ✭ 175 (-42.81%)
Mutual labels:  reactive, reactive-streams, test
assembler
Functional, type-safe, stateless reactive Java API for efficient implementation of the API Composition Pattern for querying/merging data from multiple datasources/services, with a specific focus on solving the N + 1 query problem
Stars: ✭ 102 (-66.67%)
Mutual labels:  reactive, reactive-streams, reactive-programming
Rx.Http
A reactive way to make HTTP Request in .NET Core 🚀
Stars: ✭ 62 (-79.74%)
Mutual labels:  reactive, reactive-streams, reactive-programming
reacted
Actor based reactive java framework for microservices in local and distributed environment
Stars: ✭ 17 (-94.44%)
Mutual labels:  reactive, reactive-streams, reactive-programming
TermiNetwork
🌏 A zero-dependency networking solution for building modern and secure iOS, watchOS, macOS and tvOS applications.
Stars: ✭ 80 (-73.86%)
Mutual labels:  apple, tvos
WacOS
A Linux distribution that mimics MacOS (modern and classic) iOS, and other Apple operating systems, but is open, customizable, and free to use on non-apple hardware.
Stars: ✭ 18 (-94.12%)
Mutual labels:  apple, tvos
Toy Rx
A tiny implementation of RxJS that actually works, for learning
Stars: ✭ 290 (-5.23%)
Mutual labels:  reactive, reactive-programming
gmock-xcode
Xcode integration for GoogleMock through XCTest
Stars: ✭ 18 (-94.12%)
Mutual labels:  test, xctest

Entwine

CI @tcldr1

Accessories for Apple's Combine Framework.


About

Entwine consists of three libraries (over two repositories) to be used in conjuction with Apple's Combine framework:

Note: EntwineRx is maintained as a separate Swift package to minimize the SPM dependency graph.


Quick start guide

Create Combine publishers from any source

Use the Publishers.Factory publisher from the Entwine package to effortlessly create a publisher that meets Combine's backpressure requirements from any source. Find out more about the Entwine Utilities library.

Inline publisher creation for PhotoKit authorization status:

import Entwine

let photoKitAuthorizationStatus = Publishers.Factory<PHAuthorizationStatus, Never> { dispatcher in
    let status = PHPhotoLibrary.authorizationStatus()
    dispatcher.forward(status)
    switch status {
    case .notDetermined:
        PHPhotoLibrary.requestAuthorization { newStatus in
            dispatcher.forward(newStatus)
            dispatcher.forward(completion: .finished)
        }
    default:
        dispatcher.forward(completion: .finished)
    }
    return AnyCancellable {}
}

Unit test Combine publisher sequences

Use the TestScheduler, TestablePublisher and TestableSubscriber to simulate Combine sequences and test against expected output. Find out more about the EntwineTest library

Testing Combine's map(_:) operator:

import XCTest
import EntwineTest
    
func testMap() {
    
    let testScheduler = TestScheduler(initialClock: 0)
    
    // creates a publisher that will schedule it's elements relatively, at the point of subscription
    let testablePublisher: TestablePublisher<String, Never> = testScheduler.createRelativeTestablePublisher([
        (100, .input("a")),
        (200, .input("b")),
        (300, .input("c")),
    ])
    
    let subjectUnderTest = testablePublisher.map { $0.uppercased() }
    
    // schedules a subscription at 200, to be cancelled at 900
    let results = testScheduler.start { subjectUnderTest }
    
    XCTAssertEqual(results.recordedOutput, [
        (200, .subscription),           // subscribed at 200
        (300, .input("A")),             // received uppercased input @ 100 + subscription time
        (400, .input("B")),             // received uppercased input @ 200 + subscription time
        (500, .input("C")),             // received uppercased input @ 300 + subscription time
    ])
}

Bridge your RxSwift view models to Combine and use with SwiftUI

First, make sure you add the EntwineRx Swift Package (located in an external repo) as a dependency to your project.

Example coming soon


Requirements

Entwine sits on top of Apple's Combine framework and therefore requires Xcode 11 and is has minimum deployment targets of macOS 10.15, iOS 13, tvOS 13 or watchOS 6.


Installation

Entwine is delivered via a Swift Package and can be installed either as a dependency to another Swift Package by adding it to the dependencies section of a Package.swift file or to an Xcode 11 project by via the File -> Swift Packages -> Add package dependency... menu in Xcode 11.


Documentation

Documentation for each package is available at:


Copyright and license

This project is released under the MIT license


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].