Skip to content

Commit

Permalink
[feat] #154 RemindSplit ์ž‘์„ฑ
Browse files Browse the repository at this point in the history
  • Loading branch information
ShapeKim98 committed Oct 24, 2024
1 parent 67b4c6a commit 7e37f77
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 0 deletions.
155 changes: 155 additions & 0 deletions Projects/App/Sources/MainTabSplit/Remind/RemindSplitFeature.swift
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 Projects/App/Sources/MainTabSplit/Remind/RemindSplitView.swift
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() }
)
)
}


0 comments on commit 7e37f77

Please sign in to comment.