-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
67b4c6a
commit 7e37f77
Showing
2 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
155 changes: 155 additions & 0 deletions
155
Projects/App/Sources/MainTabSplit/Remind/RemindSplitFeature.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 |
---|---|---|
@@ -0,0 +1,155 @@ | ||
// | ||
// RemindSplitFeature.swift | ||
// App | ||
// | ||
// Created by ๊น๋ํ on 10/24/24. | ||
|
||
import ComposableArchitecture | ||
import FeaturePokit | ||
import FeatureCategoryDetail | ||
import FeatureCategorySetting | ||
import FeatureCategorySharing | ||
import FeatureSetting | ||
import FeatureContentSetting | ||
import FeatureContentDetail | ||
import FeatureRemind | ||
import FeatureContentDetail | ||
import Domain | ||
import Util | ||
|
||
@Reducer | ||
public struct RemindSplitFeature { | ||
/// - Dependency | ||
|
||
/// - State | ||
@ObservableState | ||
public struct State: Equatable { | ||
var pokit: PokitRootFeature.State = .init() | ||
var categoryDetail: CategoryDetailFeature.State? | ||
var contentSetting: ContentSettingFeature.State? | ||
|
||
@Presents | ||
var categorySetting: PokitCategorySettingFeature.State? | ||
@Presents | ||
var search: PokitSearchFeature.State? | ||
@Presents | ||
var setting: PokitSettingFeature.State? | ||
@Presents | ||
var contentDetail: ContentDetailFeature.State? | ||
|
||
@Shared(.inMemory("PushTapped")) | ||
var isPushTapped: Bool = false | ||
|
||
public init() {} | ||
} | ||
|
||
/// - Action | ||
public enum Action: FeatureAction, ViewAction { | ||
case view(View) | ||
case inner(InnerAction) | ||
case async(AsyncAction) | ||
case scope(ScopeAction) | ||
case delegate(DelegateAction) | ||
case pokit(PokitRootFeature.Action) | ||
case categoryDetail(CategoryDetailFeature.Action) | ||
case contentSetting(ContentSettingFeature.Action) | ||
|
||
@CasePathable | ||
public enum View: Equatable { | ||
case ๋ทฐ๊ฐ_๋ํ๋ฌ์๋ | ||
} | ||
|
||
public enum InnerAction: Equatable { | ||
case ์นดํ ๊ณ ๋ฆฌ_์์ธ_ํ์ฑํ(BaseCategoryItem) | ||
} | ||
|
||
public enum AsyncAction: Equatable { case doNothing } | ||
|
||
public enum ScopeAction { | ||
case pokit(PokitRootFeature.Action) | ||
case categoryDetail(CategoryDetailFeature.Action) | ||
case contentSetting(ContentSettingFeature.Action) | ||
} | ||
|
||
public enum DelegateAction: Equatable { case doNothing } | ||
} | ||
|
||
/// - Initiallizer | ||
public init() {} | ||
|
||
/// - Reducer Core | ||
private func core(into state: inout State, action: Action) -> Effect<Action> { | ||
switch action { | ||
/// - View | ||
case .view(let viewAction): | ||
return handleViewAction(viewAction, state: &state) | ||
|
||
/// - Inner | ||
case .inner(let innerAction): | ||
return handleInnerAction(innerAction, state: &state) | ||
|
||
/// - Async | ||
case .async(let asyncAction): | ||
return handleAsyncAction(asyncAction, state: &state) | ||
|
||
/// - Scope | ||
case .scope(let scopeAction): | ||
return handleScopeAction(scopeAction, state: &state) | ||
|
||
/// - Delegate | ||
case .delegate(let delegateAction): | ||
return handleDelegateAction(delegateAction, state: &state) | ||
case .pokit(let pokitAction): | ||
return .send(.scope(.pokit(pokitAction))) | ||
case .categoryDetail(let categoryDetailAction): | ||
return .send(.scope(.categoryDetail(categoryDetailAction))) | ||
case .contentSetting(let contentSettingAction): | ||
return .send(.scope(.contentSetting(contentSettingAction))) | ||
} | ||
} | ||
|
||
/// - Reducer body | ||
public var body: some ReducerOf<Self> { | ||
Reduce(self.core) | ||
} | ||
} | ||
//MARK: - FeatureAction Effect | ||
private extension RemindSplitFeature { | ||
/// - View Effect | ||
func handleViewAction(_ action: Action.View, state: inout State) -> Effect<Action> { | ||
return .none | ||
} | ||
|
||
/// - Inner Effect | ||
func handleInnerAction(_ action: Action.InnerAction, state: inout State) -> Effect<Action> { | ||
switch action { | ||
case let .์นดํ ๊ณ ๋ฆฌ_์์ธ_ํ์ฑํ(category): | ||
state.categoryDetail = .init(category: category) | ||
return .none | ||
} | ||
} | ||
|
||
/// - Async Effect | ||
func handleAsyncAction(_ action: Action.AsyncAction, state: inout State) -> Effect<Action> { | ||
return .none | ||
} | ||
|
||
/// - Scope Effect | ||
func handleScopeAction(_ action: Action.ScopeAction, state: inout State) -> Effect<Action> { | ||
switch action { | ||
case let .pokit(.delegate(.categoryTapped(category))): | ||
return .send(.inner(.์นดํ ๊ณ ๋ฆฌ_์์ธ_ํ์ฑํ(category))) | ||
case .pokit: | ||
return .none | ||
case .categoryDetail: | ||
return .none | ||
case .contentSetting: | ||
return .none | ||
} | ||
} | ||
|
||
/// - Delegate Effect | ||
func handleDelegateAction(_ action: Action.DelegateAction, state: inout State) -> Effect<Action> { | ||
return .none | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
Projects/App/Sources/MainTabSplit/Remind/RemindSplitView.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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// RemindSplitView.swift | ||
// App | ||
// | ||
// Created by ๊น๋ํ on 10/24/24. | ||
|
||
import ComposableArchitecture | ||
import SwiftUI | ||
|
||
@ViewAction(for: RemindSplitFeature.self) | ||
public struct RemindSplitView: View { | ||
/// - Properties | ||
public var store: StoreOf<RemindSplitFeature> | ||
|
||
/// - Initializer | ||
public init(store: StoreOf<RemindSplitFeature>) { | ||
self.store = store | ||
} | ||
} | ||
//MARK: - View | ||
public extension RemindSplitView { | ||
var body: some View { | ||
WithPerceptionTracking { | ||
VStack { | ||
Text("Hello World!") | ||
} | ||
} | ||
} | ||
} | ||
//MARK: - Configure View | ||
private extension RemindSplitView { | ||
|
||
} | ||
//MARK: - Preview | ||
#Preview { | ||
RemindSplitView( | ||
store: Store( | ||
initialState: .init(), | ||
reducer: { RemindSplitFeature() } | ||
) | ||
) | ||
} | ||
|
||
|