Skip to content

Commit

Permalink
Merge pull request #3 from weegigs/feature/combine
Browse files Browse the repository at this point in the history
fix: correct visability of containers
  • Loading branch information
kevinoneill authored Aug 9, 2019
2 parents a959459 + fa960ae commit 9df3357
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions Sources/SwifTEA/StateContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import SwiftUI

struct StateContainer<Environment, State, Message, Props, Content>: View where Content: View {
typealias Dispatcher = Store<Environment, State, Message>.Dispatcher
public struct StateContainer<Environment, State, Message, Props, Content>: View where Content: View {
public typealias Dispatcher = Store<Environment, State, Message>.Dispatcher

@EnvironmentObject private var store: Store<Environment, State, Message>
@EnvironmentObject private var dispatcher: Dispatcher
Expand All @@ -27,20 +27,20 @@ struct StateContainer<Environment, State, Message, Props, Content>: View where C
}
}

extension StateContainer {
public init(_ keypath: KeyPath<State, Props>, render: @escaping (Props, Dispatcher) -> Content) {
public extension StateContainer {
init(_ keypath: KeyPath<State, Props>, render: @escaping (Props, Dispatcher) -> Content) {
self.init(read: { $0[keyPath: keypath] }, render: render)
}

public init<A, B>(_ a: KeyPath<State, A>, _ b: KeyPath<State, B>, render: @escaping ((A, B), Dispatcher) -> Content) where Props == (A, B) {
init<A, B>(_ a: KeyPath<State, A>, _ b: KeyPath<State, B>, render: @escaping ((A, B), Dispatcher) -> Content) where Props == (A, B) {
self.init(read: { ($0[keyPath: a], $0[keyPath: b]) }, render: render)
}

public init<A, B, C>(_ a: KeyPath<State, A>, _ b: KeyPath<State, B>, _ c: KeyPath<State, C>, render: @escaping ((A, B, C), Dispatcher) -> Content) where Props == (A, B, C) {
init<A, B, C>(_ a: KeyPath<State, A>, _ b: KeyPath<State, B>, _ c: KeyPath<State, C>, render: @escaping ((A, B, C), Dispatcher) -> Content) where Props == (A, B, C) {
self.init(read: { ($0[keyPath: a], $0[keyPath: b], $0[keyPath: c]) }, render: render)
}

public init<A, B, C, D>(_ a: KeyPath<State, A>, _ b: KeyPath<State, B>, _ c: KeyPath<State, C>, _ d: KeyPath<State, D>, render: @escaping ((A, B, C, D), Dispatcher) -> Content) where Props == (A, B, C, D) {
init<A, B, C, D>(_ a: KeyPath<State, A>, _ b: KeyPath<State, B>, _ c: KeyPath<State, C>, _ d: KeyPath<State, D>, render: @escaping ((A, B, C, D), Dispatcher) -> Content) where Props == (A, B, C, D) {
self.init(read: { ($0[keyPath: a], $0[keyPath: b], $0[keyPath: c], $0[keyPath: d]) }, render: render)
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwifTEA/StoreContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
import SwiftUI
import WeeDux

struct StoreContainer<Environment, State, Message, Content>: View where Content: View {
public struct StoreContainer<Environment, State, Message, Content>: View where Content: View {
@ObservedObject private var store: Store<Environment, State, Message>

private let content: () -> Content

var body: some View {
public var body: some View {
content()
.environmentObject(self.store)
.environmentObject(self.store.dispatcher)
}

init(for store: Store<Environment, State, Message>, content: @escaping () -> Content) {
public init(for store: Store<Environment, State, Message>, content: @escaping () -> Content) {
self.store = store
self.content = content
}
Expand Down

0 comments on commit 9df3357

Please sign in to comment.