• Stars
    star
    307
  • Rank 136,109 (Top 3 %)
  • Language
    Swift
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A library for managing complex workflows in Swift

SwiftCurrent

Supported Platforms Swift Package Manager Pod Version License Build Status Code Coverage

Welcome

SwiftCurrent is a library that lets you easily manage journeys through your Swift application and comes with built-in support for UIKit and SwiftUI app-routing.

Why Should I Use SwiftCurrent?

In SwiftCurrent, workflows are a sequence of operations. Those operations usually display views in an application. The workflow describes the sequence of views and manages which view should come next. Your views are responsible for performing necessary tasks before proceeding forward in the workflow, like processing user input.

Architectural patterns and libraries that attempt to create a separation between views and workflows already exist. However, SwiftCurrent is different. We took a new design approach that focuses on:

  • A Developer-Friendly API. The library was built with developers in mind. It started with a group of developers talking about the code experience they desired. Then the library team took on whatever complexities were necessary to bring them that experience.
  • Compile-Time Safety. At compile-time, we tell you everything we can so you know things will work.
  • Minimal Boilerplate. We have hidden this as much as possible. We hate it as much as you do and are constantly working on cutting the cruft.

From There, We Created a Library

This library:

  • Isolates Your Views. Design your views so that they are unaware of the view that will come next.
  • Easily Reorders Views. Changing view order is as easy as ⌘+βŒ₯+[ (moving the line up or down).
  • Composes Workflows Together. Create branching flows easily by joining workflows together.
  • Creates Conditional Flows. Make your flows robust and handle ever-changing designs. Need a screen to only to show up sometimes? Need a flow for person A and another for person B? We've got you covered.

Quick Start

Why show a quick start when we have an example app? Because it's so easy to get started, we can drop in two code snippets, and you're ready to go! This quick start uses Swift Package Manager and SwiftUI, but for other approaches, see our installation instructions.

.package(url: "https://github.com/wwt/SwiftCurrent.git", .upToNextMajor(from: "5.1.0")),
...
.product(name: "SwiftCurrent", package: "SwiftCurrent"),
.product(name: "SwiftCurrent_SwiftUI", package: "SwiftCurrent")

Then make your first FlowRepresentable view:

import SwiftCurrent
import SwiftUI
struct OptionalView: View, FlowRepresentable {
    weak var _workflowPointer: AnyFlowRepresentable?
    let input: String
    init(with args: String) { input = args }
    var body: some View { Text("Only shows up if no input") }
    func shouldLoad() -> Bool { input.isEmpty }
}
struct ExampleView: View, PassthroughFlowRepresentable {
    weak var _workflowPointer: AnyFlowRepresentable?
    var body: some View { Text("This is ExampleView!") }
}

Then from your ContentView or whatever view (or app) you'd like to contain the workflow, add the following view to the body:

import SwiftCurrent_SwiftUI
// ...
var body: some View { 
    // ... other view code (if any)
    WorkflowView(launchingWith: "Skip optional screen") {
        WorkflowItem(OptionalView.self)
        WorkflowItem(ExampleView.self)
    }
}

And just like that, you've got a workflow! You can now add more items to it or reorder the items that are there. To understand more of how this works, check out our developer docs.

Server Driven Workflows

SwiftCurrent now supports server driven workflows! Check out our schema for details on defining workflows with JSON, YAML, or any other key/value-based data format. Then, simply have your FlowRepresentable types that you wish to decode conform to WorkflowDecodable and decode the workflow. For more information, see our docs.

Look at Our Example Apps

We have example apps for both SwiftUI and UIKit that show SwiftCurrent in action. They've already been tested, so you can see what it's like to test SwiftCurrent code. To run it locally, start by cloning the repo, open SwiftCurrent.xcworkspace and then run the SwiftUIExample scheme or the UIKitExample scheme.

For specific documentation check out:

Feedback

If you like what you've seen, consider giving us a star! If you don't, let us know how we can improve.

Stars

Special Thanks

SwiftCurrent would not be nearly as amazing without all of the great work done by the authors of our test dependencies:

More Repositories

1

guac

Apache Guacamole client ported to Go
Go
87
star
2

guac-vue

simple Vue client to Guacamole
Vue
53
star
3

network-config-scraper

Automated network configuration backups using Github actions and git-scraping
Python
20
star
4

ansiblefest2021-molecule-cml-demo

Repository Containing Code Examples from Comprehensive Network Automation Testing with Molecule and Cisco Modeling Labs session presented at Ansiblefest 2021
Jinja
18
star
5

docker-foundations

Docker Foundations Hands-On Walkthrough
JavaScript
8
star
6

building-a-python-sdk

The goal of this repository is to provide an overview of how to create a Python SDK targeted at a couple of the Cisco product APIs. Yes...there are already SDKs created for these products, but the goal isn't develop a production quality SDK when one already exists, but to provide a guided walk-through to gain hands-on experience using many of the sktill learned.
Dockerfile
7
star
7

spring-boot-test-oauth2-resource-server

Kotlin
6
star
8

dcauto-study-resources

Study Resources for the Cisco DevNet DCAUTO Exam
Jupyter Notebook
6
star
9

testing-android-datastore

Sample project showing how to cleanly test code using Android's DataStore.
Kotlin
6
star
10

ansible-meraki-demo

Ansible + Meraki - End-to-End Edge Network Lifecycle Demo
5
star
11

meraki_collection

Ansible Collection for deploying a new Meraki site
Jinja
4
star
12

csna

Cisco Secure Network Analytics (formerly Stealthwatch) app for Splunk SOAR (formerly Splunk Phantom). Refer to the Splunk and Cisco product documentation on installation and configuration of the respective platforms. After installing this app in Splunk SOAR, refer to the documentation for configuration and use.
Python
4
star
13

tdd201-apple-platforms

Swift
3
star
14

Jetflow

A library for managing complex workflows in Android
Kotlin
3
star
15

flask-SocketIO

JavaScript
3
star
16

SwiftNetworking

Highly Testable Swift Networking Lib
Swift
3
star
17

WorkflowSchema

2
star
18

eda_collection

Event-Driven Ansible Collection
Python
2
star
19

JS-Contact-Search-Service

A Code Sample Option for JS Candidates.
JavaScript
2
star
20

git-foundations

Git Foundations Hands-On Walkthrough
Shell
2
star
21

testing-async-await

Examples showing how to test async/await in Swift 5.5
Swift
2
star
22

devasc-data-formats

DevNet Associate Data Encoding Formats Hands-On Study Resources
Jupyter Notebook
2
star
23

dnac_site_settings_example

Sample use case for using the Ansible wwt.ansible_dnac collection created for Cisco Automation Exchange.
2
star
24

as-dotnet-string-encoder

String encoder exercise for interviewing
C#
1
star
25

devasc-netconf-intro

DevNet Associate Introduction to NETCONF
Jupyter Notebook
1
star
26

Swifterviewing

Swift/iOS Interview Template for WWTAS
Swift
1
star
27

pulumi-templates

Pulumi project templates
Smarty
1
star
28

Nimbleviewing

Kotlin/Android Interview Template for WWTAS
Kotlin
1
star
29

spring-boot-kotlin-testcontainers

An example project demonstrating the use of Testcontainers with Spring Boot using the Kotlin programming language.
Kotlin
1
star
30

FlutterIntegrationExample

Swift
1
star
31

java-city-data-processor

Java
1
star
32

Cisco-Arcus

Cisco Arcus configuration
1
star
33

synchronous-combine

Example playground to show how to make synchronous network calls with Combine.
Swift
1
star
34

parking-garage-python

Python
1
star
35

waterlogged

iOS 14 project to explore static Widget configuration
Swift
1
star
36

curl-requests-foundations

cURL & Python Requests Foundations Hands-On Walkthrough
Python
1
star