DevYeom / OneWay

A Swift library for state management with unidirectional data flow.
https://swiftpackageindex.com/DevYeom/OneWay/2.9.0/documentation/oneway
MIT License
78 stars 8 forks source link

Add a bind function to receive global events #26

Closed DevYeom closed 1 year ago

DevYeom commented 1 year ago

Related Issues 💭

Description 📝

Add a bind function to receive global events.

Additional Notes 📚

func bind() -> AnyEffect<Action> {
    return .merge(
        .sequence { send in
            for await value in values {
                send(Action.response(value))
            }
        },
        .sequence { send in
            for await value in otherValues {
                send(Action.response(value))
            }
        }
    )
}

Checklist ✅