Skip to content

Commit ae756a8

Browse files
authored
#158 merge: PR Merge
[Feat] #157 - 탭바 터치이펙트 적용
2 parents cc361a6 + bb71177 commit ae756a8

File tree

13 files changed

+256
-11
lines changed

13 files changed

+256
-11
lines changed

Walkie-iOS/Project.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ let project = Project(
8484
.external(name: "FirebaseCore"),
8585
.external(name: "FirebaseMessaging"),
8686
.external(name: "FirebaseAnalytics"),
87+
.external(name: "FirebaseRemoteConfig"),
8788
.external(name: "Moya"),
8889
.external(name: "CombineMoya"),
8990
.external(name: "KakaoSDKAuth"),

Walkie-iOS/Walkie-iOS/Sources/App/Coordinator/CoordinatorImpl/AppCoordinator.swift

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ final class AppCoordinator: Coordinator, ObservableObject {
4343

4444
init(diContainer: DIContainer) {
4545
self.diContainer = diContainer
46-
startSplash()
4746
initializeStepCoordinator()
4847
NotificationCenter.default
4948
.publisher(for: .reissueFailed)
@@ -62,7 +61,7 @@ final class AppCoordinator: Coordinator, ObservableObject {
6261
func buildScene(_ scene: AppScene) -> some View {
6362
switch scene {
6463
case .splash:
65-
SplashView()
64+
diContainer.buildSplashView(appCoordinator: self)
6665
case .nickname:
6766
diContainer.buildNicknameView()
6867
case .login:
@@ -114,14 +113,17 @@ final class AppCoordinator: Coordinator, ObservableObject {
114113
let cancelAction,
115114
let checkAction,
116115
let checkTitle,
117-
let cancelTitle
116+
let cancelTitle,
117+
let tapDismiss
118118
):
119119
ZStack {
120120
Color.black.opacity(appFullScreenCover != nil ? 0.6 : 0.0)
121121
.ignoresSafeArea()
122122
.onTapGesture {
123123
withAnimation(.easeInOut(duration: 0.25)) {
124-
self.dismissFullScreenCover()
124+
if tapDismiss {
125+
self.dismissFullScreenCover()
126+
}
125127
}
126128
}
127129
Modal(
@@ -134,7 +136,9 @@ final class AppCoordinator: Coordinator, ObservableObject {
134136
cancelAction()
135137
},
136138
checkButtonAction: {
137-
self.dismissFullScreenCover()
139+
if tapDismiss {
140+
self.dismissFullScreenCover()
141+
}
138142
checkAction()
139143
},
140144
checkButtonTitle: checkTitle,
@@ -191,7 +195,7 @@ final class AppCoordinator: Coordinator, ObservableObject {
191195
}
192196
}
193197

194-
private func startSplash() {
198+
func startSplash() {
195199
currentScene = .splash
196200
DispatchQueue.main.asyncAfter(deadline: .now() + 2) { [weak self] in
197201
self?.updateCurrentScene()
@@ -211,7 +215,8 @@ final class AppCoordinator: Coordinator, ObservableObject {
211215
cancelButtonAction: @escaping () -> Void,
212216
checkButtonAction: @escaping () -> Void,
213217
checkButtonTitle: String = "확인",
214-
cancelButtonTitle: String = "취소"
218+
cancelButtonTitle: String = "취소",
219+
tapDismiss: Bool = true
215220
) {
216221
presentFullScreenCover(
217222
AppFullScreenCover.alert(
@@ -222,7 +227,8 @@ final class AppCoordinator: Coordinator, ObservableObject {
222227
cancelAction: cancelButtonAction,
223228
checkAction: checkButtonAction,
224229
checkTitle: checkButtonTitle,
225-
cancelTitle: cancelButtonTitle
230+
cancelTitle: cancelButtonTitle,
231+
tapDismiss: tapDismiss
226232
),
227233
onDismiss: nil
228234
)

Walkie-iOS/Walkie-iOS/Sources/App/Manager/DIContainer.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ extension DIContainer {
6262

6363
extension DIContainer {
6464

65+
func makeSplashViewModel(
66+
appCoordinator: AppCoordinator
67+
) -> SplashViewModel {
68+
return SplashViewModel(appCoordinator: appCoordinator)
69+
}
70+
6571
func makeHomeViewModel(appCoordinator: AppCoordinator) -> HomeViewModel {
6672
return HomeViewModel(
6773
getEggPlayUseCase: resolveGetEggPlayUseCase(),
@@ -179,6 +185,16 @@ extension DIContainer {
179185

180186
extension DIContainer {
181187

188+
func buildSplashView(
189+
appCoordinator: AppCoordinator
190+
) -> SplashView {
191+
return SplashView(
192+
splashViewModel: self.makeSplashViewModel(
193+
appCoordinator: appCoordinator
194+
)
195+
)
196+
}
197+
182198
// MARK: - Main Views
183199
func buildTabBarView() -> TabBarView {
184200
return TabBarView()
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//
2+
// ButtonStyle+.swift
3+
// Walkie-iOS
4+
//
5+
// Created by 고아라 on 6/4/25.
6+
//
7+
8+
import SwiftUI
9+
10+
struct WalkieTouchEffect: ButtonStyle {
11+
func makeBody(configuration: Configuration) -> some View {
12+
let pressedScale: CGFloat = 0.8
13+
let normalScale: CGFloat = 1.0
14+
15+
let pressAnimation = Animation.spring(
16+
response: 0.15,
17+
dampingFraction: 0.6,
18+
blendDuration: 0
19+
)
20+
let releaseAnimation = Animation.spring(
21+
response: 0.5,
22+
dampingFraction: 0.7,
23+
blendDuration: 0
24+
)
25+
26+
return configuration.label
27+
.scaleEffect(configuration.isPressed ? pressedScale : normalScale)
28+
.animation(
29+
configuration.isPressed
30+
? pressAnimation
31+
: releaseAnimation,
32+
value: configuration.isPressed
33+
)
34+
.onChange(of: configuration.isPressed) { _, isPressed in
35+
if isPressed {
36+
HapticManager.shared.impact(style: .light)
37+
}
38+
}
39+
}
40+
}
41+
42+
struct HapticButtonStyle: ButtonStyle {
43+
let style: UIImpactFeedbackGenerator.FeedbackStyle
44+
45+
func makeBody(configuration: Configuration) -> some View {
46+
configuration.label
47+
.scaleEffect(configuration.isPressed ? 0.95 : 1.0)
48+
.opacity(configuration.isPressed ? 0.7 : 1.0)
49+
.onChange(of: configuration.isPressed) { _, pressed in
50+
if pressed {
51+
HapticManager.shared.impact(style: style)
52+
}
53+
}
54+
.animation(.easeInOut(duration: 0.1), value: configuration.isPressed)
55+
}
56+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// HapticManager.swift
3+
// Walkie-iOS
4+
//
5+
// Created by 고아라 on 6/4/25.
6+
//
7+
8+
import UIKit
9+
10+
final class HapticManager {
11+
12+
static let shared = HapticManager()
13+
14+
private init() { }
15+
16+
func impact(style: UIImpactFeedbackGenerator.FeedbackStyle = .medium) {
17+
let generator = UIImpactFeedbackGenerator(style: style)
18+
generator.prepare()
19+
generator.impactOccurred()
20+
}
21+
}

Walkie-iOS/Walkie-iOS/Sources/Extension/View+.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ extension View {
2424
func popGestureEnabled(_ enabled: Bool) -> some View {
2525
background(PopGestureConfigurator(enabled: enabled))
2626
}
27+
28+
func applyHaptic(
29+
_ style: UIImpactFeedbackGenerator.FeedbackStyle = .medium
30+
) -> some View {
31+
modifier(HapticOnTapModifier(style: style))
32+
}
33+
34+
func walkieTouchEffect() -> some View {
35+
self.buttonStyle(WalkieTouchEffect())
36+
}
2737
}
2838

2939
// MARK: - AlignmentModifier
@@ -137,3 +147,17 @@ extension View {
137147
}
138148
}
139149
}
150+
151+
// Haptic
152+
153+
struct HapticOnTapModifier: ViewModifier {
154+
155+
let style: UIImpactFeedbackGenerator.FeedbackStyle
156+
157+
func body(content: Content) -> some View {
158+
content
159+
.onTapGesture {
160+
HapticManager.shared.impact(style: style)
161+
}
162+
}
163+
}

Walkie-iOS/Walkie-iOS/Sources/Network/Base/URLConstant.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ enum URLConstant {
1313

1414
static let baseURL = Config.baseURL
1515

16+
// MARK: - AppStore URL
17+
18+
static let appStoreURL = "itms-apps://itunes.apple.com/app/id6742345668"
19+
1620
// MARK: - URL Path
1721

1822
// auth

Walkie-iOS/Walkie-iOS/Sources/Presentation/Common/Modal/Modal.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct Modal: View {
4444
.foregroundColor(WalkieCommonAsset.gray700.swiftUIColor)
4545
.padding(.horizontal, 16)
4646
.padding(.bottom, 4)
47+
.multilineTextAlignment(.center)
4748

4849
Text(content)
4950
.font(.B2)

Walkie-iOS/Walkie-iOS/Sources/Presentation/Common/TabBar/TabBarView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct TabBarView: View {
5858
}
5959
)
6060
.frame(maxWidth: .infinity)
61+
.walkieTouchEffect()
6162
}
6263
}
6364
.frame(height: 52)

Walkie-iOS/Walkie-iOS/Sources/Presentation/Onboarding/Login/LoginView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ struct LoginView: View {
114114
cancelAction: {},
115115
checkAction: {},
116116
checkTitle: "확인",
117-
cancelTitle: ""),
117+
cancelTitle: "",
118+
tapDismiss: true
119+
),
118120
onDismiss: {
119121
loginViewModel.state = .loading
120122
}

0 commit comments

Comments
 (0)