-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WEAV-135] 프로필, 이상형 정보 입력 Intro 뷰 생성 #45
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "heart-with-arrow.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "heart-with-arrow@2x.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "heart-with-arrow@3x.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "magnifying-glass.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "magnifying-glass@2x.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "magnifying-glass@3x.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// DreamPartnerIntroIntent.swift | ||
// SignUp | ||
// | ||
// Created by 김지수 on 11/21/24. | ||
// Copyright © 2024 com.weave. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import CommonKit | ||
import CoreKit | ||
import Model | ||
|
||
//MARK: - Intent | ||
class DreamPartnerIntroIntent { | ||
private weak var model: DreamPartnerIntroModelActionable? | ||
private let input: DataModel | ||
|
||
// MARK: Life cycle | ||
init( | ||
model: DreamPartnerIntroModelActionable, | ||
input: DataModel | ||
) { | ||
self.input = input | ||
self.model = model | ||
|
||
Task { | ||
try? await Task.sleep(for: .milliseconds(2500)) | ||
await pushNextView() | ||
} | ||
} | ||
} | ||
Comment on lines
+14
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 초기화 시 자동 전환 로직 검토 필요 Task 내에서 sleep을 사용하여 지연된 화면 전환을 구현하고 있습니다. 다음 사항들을 고려해주세요:
다음과 같이 수정하는 것을 제안드립니다: + private let transitionDelay: Double = 2.5
+ private var transitionTask: Task<Void, Error>?
init(
model: DreamPartnerIntroModelActionable,
input: DataModel
) {
self.input = input
self.model = model
- Task {
+ transitionTask = Task {
try? await Task.sleep(for: .milliseconds(2500))
await pushNextView()
}
}
+ deinit {
+ transitionTask?.cancel()
+ }
🧰 Tools🪛 SwiftLint[Warning] 14-14: Prefer at least one space after slashes for comments (comment_spacing) [Warning] 14-14: MARK comment should be in valid format. e.g. '// MARK: ...' or '// MARK: - ...' (mark) |
||
|
||
//MARK: - Intentable | ||
extension DreamPartnerIntroIntent { | ||
protocol Intentable { | ||
// content | ||
func pushNextView() async | ||
func onTapNextButton() | ||
|
||
// default | ||
func onAppear() | ||
func task() async | ||
} | ||
|
||
struct DataModel { | ||
let input: SignUpFormDomain | ||
} | ||
} | ||
|
||
//MARK: - Intentable | ||
extension DreamPartnerIntroIntent: DreamPartnerIntroIntent.Intentable { | ||
// default | ||
func onAppear() {} | ||
|
||
func task() async {} | ||
|
||
// content | ||
@MainActor | ||
func pushNextView() async { | ||
AppCoordinator.shared.changeRootView( | ||
.signUp(.dreamPartnerAgeRange(input: input.input)) | ||
) | ||
} | ||
func onTapNextButton() {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
// DreamPartnerIntroModel.swift | ||
// SignUp | ||
// | ||
// Created by 김지수 on 11/21/24. | ||
// Copyright © 2024 com.weave. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import CommonKit | ||
import CoreKit | ||
|
||
final class DreamPartnerIntroModel: ObservableObject { | ||
|
||
//MARK: Stateful | ||
protocol Stateful { | ||
// content | ||
var isValidated: Bool { get } | ||
|
||
// default | ||
var isLoading: Bool { get } | ||
|
||
// error | ||
var showErrorView: ErrorModel? { get } | ||
var showErrorAlert: ErrorModel? { get } | ||
} | ||
|
||
//MARK: State Properties | ||
// content | ||
@Published var isValidated: Bool = false | ||
|
||
// default | ||
@Published var isLoading: Bool = false | ||
|
||
// error | ||
@Published var showErrorView: ErrorModel? | ||
@Published var showErrorAlert: ErrorModel? | ||
} | ||
|
||
extension DreamPartnerIntroModel: DreamPartnerIntroModel.Stateful {} | ||
|
||
//MARK: - Actionable | ||
protocol DreamPartnerIntroModelActionable: AnyObject { | ||
// content | ||
func setValidation(value: Bool) | ||
|
||
// default | ||
func setLoading(status: Bool) | ||
|
||
// error | ||
func showErrorView(error: ErrorModel) | ||
func showErrorAlert(error: ErrorModel) | ||
func resetError() | ||
} | ||
|
||
extension DreamPartnerIntroModel: DreamPartnerIntroModelActionable { | ||
// content | ||
func setValidation(value: Bool) { | ||
isValidated = value | ||
} | ||
|
||
// default | ||
func setLoading(status: Bool) { | ||
isLoading = status | ||
} | ||
|
||
// error | ||
func showErrorView(error: ErrorModel) { | ||
showErrorView = error | ||
} | ||
func showErrorAlert(error: ErrorModel) { | ||
showErrorAlert = error | ||
} | ||
func resetError() { | ||
showErrorView = nil | ||
showErrorAlert = nil | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
해시 값 할당 방식의 개선이 필요합니다.
현재 인트로 화면들에 대해 음수 값(-1, -2)을 사용하고 있는데, 이는 기존의 양수 시퀀스 패턴과 일치하지 않습니다. 유지보수성을 높이기 위해 일관된 번호 체계를 사용하는 것이 좋습니다.
다음과 같이 수정하는 것을 제안드립니다:
Also applies to: 140-141