Skip to content

Commit

Permalink
[Feat] InfoDetailView Coordinator 연결 - #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin0331 committed Feb 1, 2025
1 parent 28be3b3 commit eb9db1b
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 5 deletions.
20 changes: 18 additions & 2 deletions Whidy-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
6BF2D87E2D4A66A300252A43 /* AuthInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BF2D87D2D4A66A300252A43 /* AuthInterceptor.swift */; };
6BF2D8802D4A6FD700252A43 /* OnboardingCoordinatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BF2D87F2D4A6FD700252A43 /* OnboardingCoordinatorView.swift */; };
6BF2D8822D4C51E600252A43 /* SearchView+ChildView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BF2D8812D4C51E600252A43 /* SearchView+ChildView.swift */; };
6BF2D9302D4DD51D00252A43 /* InfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BF2D92F2D4DD51D00252A43 /* InfoView.swift */; };
6BF2D94B2D4E696900252A43 /* InfoDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BF2D94A2D4E696900252A43 /* InfoDetailView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -249,6 +251,8 @@
6BF2D87D2D4A66A300252A43 /* AuthInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthInterceptor.swift; sourceTree = "<group>"; };
6BF2D87F2D4A6FD700252A43 /* OnboardingCoordinatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingCoordinatorView.swift; sourceTree = "<group>"; };
6BF2D8812D4C51E600252A43 /* SearchView+ChildView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SearchView+ChildView.swift"; sourceTree = "<group>"; };
6BF2D92F2D4DD51D00252A43 /* InfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoView.swift; sourceTree = "<group>"; };
6BF2D94A2D4E696900252A43 /* InfoDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoDetailView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -298,6 +302,7 @@
6B6220732D37AA6C00C5F2C8 /* View */ = {
isa = PBXGroup;
children = (
6BF2D92E2D4DD50600252A43 /* Info */,
6BF2D85D2D49ECFC00252A43 /* StudyMap */,
6BF2D85E2D49ED0400252A43 /* Search */,
);
Expand Down Expand Up @@ -780,6 +785,15 @@
path = Search;
sourceTree = "<group>";
};
6BF2D92E2D4DD50600252A43 /* Info */ = {
isa = PBXGroup;
children = (
6BF2D92F2D4DD51D00252A43 /* InfoView.swift */,
6BF2D94A2D4E696900252A43 /* InfoDetailView.swift */,
);
path = Info;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -883,6 +897,7 @@
6B6275E62D35EFE200843C9E /* Logger.swift in Sources */,
6B6275E72D35EFE200843C9E /* LoginType.swift in Sources */,
6B6276922D35FFF100843C9E /* EmptyResponseModel.swift in Sources */,
6BF2D9302D4DD51D00252A43 /* InfoView.swift in Sources */,
6B6220912D3882C300C5F2C8 /* ScrapView.swift in Sources */,
6B6276932D35FFF100843C9E /* AppVersionResponse.swift in Sources */,
6B6276942D35FFF100843C9E /* ErrorResponse.swift in Sources */,
Expand Down Expand Up @@ -932,6 +947,7 @@
6B62763A2D35EFFB00843C9E /* ProfileImageModifier.swift in Sources */,
6B62763B2D35EFFB00843C9E /* TextToButtonModifier.swift in Sources */,
6B62763C2D35EFFB00843C9E /* NormalTextFieldModifier.swift in Sources */,
6BF2D94B2D4E696900252A43 /* InfoDetailView.swift in Sources */,
6B6220CA2D39F56A00C5F2C8 /* SignUpRequest.swift in Sources */,
6B6276892D35FDD000843C9E /* Color.swift in Sources */,
6B62763D2D35EFFB00843C9E /* DateFormatUtil.swift in Sources */,
Expand Down Expand Up @@ -1133,7 +1149,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 16.1;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 15.1;
Expand Down Expand Up @@ -1179,7 +1195,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 16.1;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 15.1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "b2bab2be8a84f0ba5753afaf70ee181b5bd28f00053e05fd444658fe753afe3c",
"originHash" : "bc170e0b56adcad178b53c3e71684a751fcdee4a481c44253c77cbe9163640a5",
"pins" : [
{
"identity" : "alamofire",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ struct StudyMapCoordinatorView : View {
StudyMapView(store: store)
case let .search(store):
SearchView(store: store)
case let .infoDetail(store):
InfoDetailView(store: store)
}
}
}
Expand All @@ -45,11 +47,16 @@ struct StudyMapCoordinator {
case .router(.routeAction(id: .studyMap, action: .studyMap(.viewTransition(.goToSearch)))):
state.routes.push(.search(.init()))

case .router(.routeAction(id: .studyMap, action: .studyMap(.viewTransition(.goToInfoDetail)))):
state.routes.presentCover(.infoDetail(.init()))

case .router(.routeAction(id: .search, action: .search(.viewTransition(.goToBack)))):
state.routes.goBack()
state.routes.goBackTo(id: .studyMap)

case let .router(.routeAction(id: .search, action: .search(.viewTransition(.goToResultLocation(location))))):
case .router(.routeAction(id: .infoDetail, action: .infoDetail(.viewTransition(.dismiss)))):
state.routes.goBackTo(id: .studyMap)

case let .router(.routeAction(id: .search, action: .search(.viewTransition(.goToResultLocation(location))))):
state.routes.goBackTo(id: .studyMap)
naverMapManager.moveToSpecificLocation(location: location)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ extension StudyMapScreen.State : Identifiable {
.studyMap
case .search:
.search
case .infoDetail:
.infoDetail
}
}

enum ID : Identifiable {
case studyMap
case search
case infoDetail
var id: ID { self }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ import ComposableArchitecture
enum StudyMapScreen {
case studyMap(StudyMapFeature)
case search(SearchFeature)
case infoDetail(InfoDetailFeature)
}
111 changes: 111 additions & 0 deletions Whidy-iOS/Presentation/Main/StudyMap/View/Info/InfoDetailView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//
// InfoDetailView.swift
// Whidy-iOS
//
// Created by JinwooLee on 2/1/25.
//

import SwiftUI

struct InfoDetailView: View {
@Perception.Bindable var store: StoreOf<InfoDetailFeature>
@State private var scrollOffset: CGFloat = 0
@State private var dragOffset: CGFloat = 0

var body: some View {
VStack {
ScrollView {
VStack(spacing: 20) {
ForEach(0..<50) { index in
Text("Item \(index)")
.frame(maxWidth: .infinity)
.padding()
.background(Color.gray.opacity(0.2))
.cornerRadius(8)
}
}
.background(GeometryReader { geometry in
Color.clear
.preference(
key: ScrollOffsetKey.self,
value: geometry.frame(in: .named("scrollView")).origin.y
)
})
}
.coordinateSpace(name: "scrollView")
.onPreferenceChange(ScrollOffsetKey.self) { value in
scrollOffset = value // ScrollView의 오프셋 업데이트
Logger.debug("scrollOffset: \(scrollOffset)")

if scrollOffset >= 120 {
store.send(.viewTransition(.dismiss))
}
}
}
.background(Color.white)
.edgesIgnoringSafeArea(.all)
}
}

// ScrollView의 오프셋을 감지하기 위한 PreferenceKey
struct ScrollOffsetKey: PreferenceKey {
static var defaultValue: CGFloat = 0

static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
value += nextValue()
}
}

import ComposableArchitecture

@Reducer
struct InfoDetailFeature {
@ObservableState
struct State : Equatable {
let id = UUID()

}

enum Action : BindableAction {
case binding(BindingAction<State>)
case networkResponse(NetworkReponse)
case buttonTapped(ButtonTapped)
case viewTransition(ViewTransition)
case anyAction(AnyAction)
}

enum ViewTransition {
case onAppear
case dismiss
}

enum NetworkReponse {

}

enum ButtonTapped {

}


enum AnyAction {

}

@Dependency(\.networkManager) var networkManager

var body : some ReducerOf<Self> {

BindingReducer()

Reduce { state, action in
switch action {


default :
break
}
return .none
}
}
}
18 changes: 18 additions & 0 deletions Whidy-iOS/Presentation/Main/StudyMap/View/Info/InfoView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// InfoView.swift
// Whidy-iOS
//
// Created by JinwooLee on 2/1/25.
//

import SwiftUI

struct InfoView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}

#Preview {
InfoView()
}

0 comments on commit eb9db1b

Please sign in to comment.