Skip to content

SwiftUI + RAF == ❤️ #60

Open
Open
@RuiAAPeres

Description

@RuiAAPeres

Hello good people. I downloaded the work that @andersio did here ReactiveCocoa/ReactiveSwift#776 and added the following extension to the Store:

@available(iOS 13.0, *)
extension Store: ObservableObject {
  public var objectWillChange: ProducerPublisher<Context<State, Event>, Never>  {
    self.state.producer.publisher()
  }
}

This seemed to be enough to power a small SwiftUI view:

struct ContentView: View {

  @ObservedObject var store: Store<Counter.State, Counter.Event>

    var body: some View {
      VStack {
        Text("\(store.state.value.count)")
      Button(action: {
        self.store.send(event: .increment)
      }, label: {
        Text("Increment")
      })
      }
    }
}

How do you think we could move this forward? ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions