Skip to content

Commit f168d3a

Browse files
committed
[feat] #173 포킷이동을 위한 시트 연결
- 포킷이동 버튼을 누르면 카테고리 선택 시트가 나오게 적용
1 parent 5e682a7 commit f168d3a

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

Projects/Feature/FeaturePokit/Sources/PokitLinkEditFeature.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public struct PokitLinkEditFeature {
1818
var item: BaseContentListInquiry
1919
var list = IdentifiedArrayOf<BaseContentItem>()
2020
var selectedItems = IdentifiedArrayOf<BaseContentItem>()
21+
var isPresented: Bool = false
2122

2223
public init(linkList: BaseContentListInquiry) {
2324
self.item = linkList
@@ -36,10 +37,12 @@ public struct PokitLinkEditFeature {
3637
case delegate(DelegateAction)
3738

3839
@CasePathable
39-
public enum View: Equatable {
40+
public enum View: BindableAction, Equatable {
41+
case binding(BindingAction<State>)
4042
case dismiss
4143

4244
case 체크박스_선택했을때(BaseContentItem)
45+
case 카테고리_선택했을때(BaseCategoryItem)
4346
}
4447

4548
public enum InnerAction: Equatable { case 없음 }
@@ -83,6 +86,7 @@ public struct PokitLinkEditFeature {
8386

8487
/// - Reducer body
8588
public var body: some ReducerOf<Self> {
89+
BindingReducer(action: \.view)
8690
Reduce(self.core)
8791
}
8892
}
@@ -91,6 +95,9 @@ private extension PokitLinkEditFeature {
9195
/// - View Effect
9296
func handleViewAction(_ action: Action.View, state: inout State) -> Effect<Action> {
9397
switch action {
98+
case .binding:
99+
return .none
100+
94101
case .dismiss:
95102
return .run { _ in await dismiss() }
96103

@@ -102,6 +109,11 @@ private extension PokitLinkEditFeature {
102109
state.selectedItems.append(item)
103110
}
104111
return .none
112+
113+
case let .카테고리_선택했을때(pokit):
114+
//TODO: 포킷이동 네트워크 구현
115+
state.isPresented = false
116+
return .none
105117
}
106118
}
107119

@@ -124,12 +136,15 @@ private extension PokitLinkEditFeature {
124136
return .none
125137

126138
case .전체선택_버튼_눌렀을때:
139+
state.selectedItems = state.list
127140
return .none
128141

129142
case .전체해제_버튼_눌렀을때:
143+
state.selectedItems.removeAll()
130144
return .none
131145

132146
case .포킷이동_버튼_눌렀을때:
147+
state.isPresented = true
133148
return .none
134149
}
135150
}

Projects/Feature/FeaturePokit/Sources/PokitLinkEditView.swift

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import CoreKit
1414
@ViewAction(for: PokitLinkEditFeature.self)
1515
public struct PokitLinkEditView: View {
1616
/// - Properties
17-
public var store: StoreOf<PokitLinkEditFeature>
17+
@Perception.Bindable public var store: StoreOf<PokitLinkEditFeature>
1818

1919
/// - Initializer
2020
public init(store: StoreOf<PokitLinkEditFeature>) {
@@ -53,6 +53,17 @@ public extension PokitLinkEditView {
5353
.padding(.horizontal, 20)
5454
.ignoresSafeArea(edges: .bottom)
5555
.padding(.bottom, 24)
56+
.sheet(isPresented: $store.isPresented) {
57+
PokitSelectSheet(
58+
list: nil,
59+
itemSelected: { send(.카테고리_선택했을때($0)) },
60+
pokitAddAction: {}
61+
)
62+
.presentationDragIndicator(.visible)
63+
.pokitPresentationCornerRadius()
64+
.presentationDetents([.height(564)])
65+
.pokitPresentationBackground()
66+
}
5667
}
5768
}
5869
}
@@ -79,7 +90,15 @@ private extension PokitLinkEditView {
7990
#Preview {
8091
PokitLinkEditView(
8192
store: Store(
82-
initialState: .init(linkList: BaseContentListInquiry(data: nil, page: 0, size: 0, sort: [], hasNext: false)),
93+
initialState: .init(
94+
linkList: BaseContentListInquiry(
95+
data: nil,
96+
page: 0,
97+
size: 0,
98+
sort: [],
99+
hasNext: false
100+
)
101+
),
83102
reducer: { PokitLinkEditFeature() }
84103
)
85104
)

0 commit comments

Comments
 (0)