Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/ReducerKit/Sources/Reducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

/// 액션에 따른 상태 변화 로직을 정의하기 위한 프로토콜
public protocol Reducer<State, Action> {
public protocol Reducer {
/// View에 표시될 데이터를 정의
associatedtype State

Expand Down
14 changes: 5 additions & 9 deletions Core/ReducerKit/Sources/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@

import Foundation

/// Store 타입을 좀 더 간편하게 정의(표현).
public typealias StoreOf<R: Reducer> = Store<R.State, R.Action>

/// Reducer를 실행하고 UI를 업데이트하는 상태 관리자
@MainActor @Observable
public final class Store<State, Action> {
public final class Store<R: Reducer> {

public typealias State = R.State
public typealias Action = R.Action

private(set) public var state: State
private let reduce: (inout State, Action) -> Effect<Action>

// Store.State == Reducer.State, Store.Action == Reducer.Action
public init<R: Reducer<State, Action>>(
initialState: State,
reducer: R
) {
public init(initialState: State, reducer: R) {
self.state = initialState
self.reduce = reducer.reduce(into:action:)
}
Expand Down
2 changes: 1 addition & 1 deletion Mark-In/Sources/Feature/AddFolder/AddFolderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ReducerKit

struct AddFolderView: View {
@Environment(\.dismiss) private var dismiss
@State private var store: StoreOf<AddFolderReducer> = .init(
@State private var store: Store<AddFolderReducer> = .init(
initialState: AddFolderReducer.State(),
reducer: AddFolderReducer()
)
Expand Down
2 changes: 1 addition & 1 deletion Mark-In/Sources/Feature/AddLink/AddLinkView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ReducerKit

struct AddLinkView: View {
@Environment(\.dismiss) var dismiss
@State private var store: StoreOf<AddLinkReducer> = .init(
@State private var store: Store<AddLinkReducer> = .init(
initialState: AddLinkReducer.State(),
reducer: AddLinkReducer()
)
Expand Down
10 changes: 5 additions & 5 deletions Mark-In/Sources/Feature/Login/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import ReducerKit
import Util

struct LoginView: View {
@State private var store: StoreOf<LoginReducer> = .init(
@State private var store: Store<LoginReducer> = .init(
initialState: LoginReducer.State(),
reducer: LoginReducer()
)
Expand Down Expand Up @@ -50,9 +50,9 @@ struct LoginView: View {
}

private struct BodyView: View {
private let store: StoreOf<LoginReducer>
private let store: Store<LoginReducer>

init(store: StoreOf<LoginReducer>) {
init(store: Store<LoginReducer>) {
self.store = store
}

Expand Down Expand Up @@ -100,9 +100,9 @@ private struct BodyView: View {

private struct SignInButtonList: View {
@Environment(\.authorizationController) private var authorizationController
private let store: StoreOf<LoginReducer>
private let store: Store<LoginReducer>

init(store: StoreOf<LoginReducer>) {
init(store: Store<LoginReducer>) {
self.store = store
}

Expand Down
2 changes: 1 addition & 1 deletion Mark-In/Sources/Feature/Main/LinkListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private enum ViewConstants {

struct LinkListView: View {

let store: StoreOf<MainReducer>
let store: Store<MainReducer>

private var links: [WebLink] {
let totalLinks = store.state.links
Expand Down
2 changes: 1 addition & 1 deletion Mark-In/Sources/Feature/Main/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import DesignSystem
import ReducerKit

struct MainView: View {
@State private var store: StoreOf<MainReducer> = .init(
@State private var store: Store<MainReducer> = .init(
initialState: MainReducer.State(),
reducer: MainReducer()
)
Expand Down
2 changes: 1 addition & 1 deletion Mark-In/Sources/Feature/Main/SideBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import DesignSystem
import ReducerKit

struct SideBar: View {
let store: StoreOf<MainReducer>
let store: Store<MainReducer>

var body: some View {
VStack(alignment: .leading) {
Expand Down
2 changes: 1 addition & 1 deletion Mark-In/Sources/Feature/MyPage/MyPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private enum ViewConstants {
}

struct MyPageView: View {
@State private var store: StoreOf<MyPageReducer> = .init(
@State private var store: Store<MyPageReducer> = .init(
initialState: MyPageReducer.State(),
reducer: MyPageReducer()
)
Expand Down
Loading