-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
196 additions
and
566 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import Combine | ||
import CombineFeedback | ||
import CombineFeedbackUI | ||
import SwiftUI | ||
|
||
extension Counter { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import Combine | ||
import CombineFeedback | ||
import CombineFeedbackUI | ||
import Foundation | ||
import SwiftUI | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import Combine | ||
import CombineFeedback | ||
import CombineFeedbackUI | ||
import SwiftUI | ||
|
||
extension SignIn { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import CombineFeedback | ||
import CombineFeedbackUI | ||
import SwiftUI | ||
|
||
struct SingleStoreExampleView: View { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,87 @@ | ||
import Combine | ||
import CombineFeedback | ||
import CombineFeedbackUI | ||
import Foundation | ||
import CasePaths | ||
import Foundation | ||
|
||
struct State { | ||
var counter = Counter.State() | ||
var movies = Movies.State(batch: .empty(), movies: [], status: .loading) | ||
var signIn = SignIn.State() | ||
var traficLight = TrafficLight.State.red | ||
var counter = Counter.State() | ||
var movies = Movies.State(batch: .empty(), movies: [], status: .loading) | ||
var signIn = SignIn.State() | ||
var traficLight = TrafficLight.State.red | ||
} | ||
|
||
enum Event { | ||
case counter(Counter.Event) | ||
case movies(Movies.Event) | ||
case signIn(SignIn.Event) | ||
case trafficLight(TrafficLight.Event) | ||
case counter(Counter.Event) | ||
case movies(Movies.Event) | ||
case signIn(SignIn.Event) | ||
case trafficLight(TrafficLight.Event) | ||
} | ||
|
||
let countReducer: Reducer<State, Event> = Counter.reducer() | ||
.pullback( | ||
value: \.counter, | ||
event: /Event.counter | ||
) | ||
.pullback( | ||
value: \.counter, | ||
event: /Event.counter | ||
) | ||
|
||
let moviesReducer: Reducer<State, Event> = Movies.reducer() | ||
.pullback( | ||
value: \.movies, | ||
event: /Event.movies | ||
) | ||
.pullback( | ||
value: \.movies, | ||
event: /Event.movies | ||
) | ||
|
||
let moviesFeedback: Feedback<State, Event, AppDependency> = Movies.feedback | ||
.pullback( | ||
value: \.movies, | ||
event: /Event.movies, | ||
dependency: \.movies | ||
) | ||
.pullback( | ||
value: \.movies, | ||
event: /Event.movies, | ||
dependency: \.movies | ||
) | ||
|
||
let signInReducer: Reducer<State, Event> = SignIn.reducer().pullback( | ||
value: \.signIn, | ||
event: /Event.signIn | ||
value: \.signIn, | ||
event: /Event.signIn | ||
) | ||
|
||
let signInFeedback: Feedback<State, Event, AppDependency> = SignIn.feedback | ||
.pullback( | ||
value: \.signIn, | ||
event: /Event.signIn, | ||
dependency: \.signIn | ||
) | ||
.pullback( | ||
value: \.signIn, | ||
event: /Event.signIn, | ||
dependency: \.signIn | ||
) | ||
|
||
let traficLightReducer: Reducer<State, Event> = TrafficLight.reducer() | ||
.pullback( | ||
value: \.traficLight, | ||
event: /Event.trafficLight | ||
) | ||
.pullback( | ||
value: \.traficLight, | ||
event: /Event.trafficLight | ||
) | ||
|
||
let trafficLightFeedback: Feedback<State, Event, AppDependency> = TrafficLight.feedback.pullback( | ||
value: \.traficLight, | ||
event: /Event.trafficLight, | ||
dependency: { _ in } | ||
value: \.traficLight, | ||
event: /Event.trafficLight, | ||
dependency: { _ in } | ||
) | ||
|
||
let appReducer = Reducer.combine( | ||
countReducer, | ||
moviesReducer, | ||
signInReducer, | ||
traficLightReducer | ||
countReducer, | ||
moviesReducer, | ||
signInReducer, | ||
traficLightReducer | ||
) | ||
|
||
struct AppDependency { | ||
let urlSession = URLSession.shared | ||
let api = GithubAPI() | ||
|
||
var movies: Movies.Dependencies { | ||
.init( | ||
movies: urlSession.movies(page:), | ||
fetchMovies: urlSession.fetchMovies(page:) | ||
) | ||
.init( | ||
movies: urlSession.movies(page:), | ||
fetchMovies: urlSession.fetchMovies(page:) | ||
) | ||
} | ||
|
||
var signIn: SignIn.Dependencies { | ||
.init( | ||
signIn: api.signIn, | ||
usernameAvailable: api.usernameAvailable(username:) | ||
) | ||
.init( | ||
signIn: api.signIn, | ||
usernameAvailable: api.usernameAvailable(username:) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import Combine | ||
import CombineFeedback | ||
import CombineFeedbackUI | ||
import SwiftUI | ||
|
||
extension TrafficLight { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import CombineFeedbackUI | ||
import CombineFeedback | ||
|
||
extension Store { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...s/CombineFeedbackUI/WithViewContext.swift → ...ces/CombineFeedback/WithViewContext.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import Combine | ||
import CombineFeedback | ||
import SwiftUI | ||
|
||
@available(*, deprecated, renamed: "WithViewContext") | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import Combine | ||
import CombineFeedback | ||
import Foundation | ||
import CasePaths | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import Combine | ||
import CombineFeedback | ||
import CasePaths | ||
import SwiftUI | ||
|
||
|
Oops, something went wrong.