-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat] Splash view UI 구현 #36
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
Changes from all commits
942334a
0b76b84
8e699eb
f3663b7
c092eb4
87e0f44
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" : "bitnagil_logo.png", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "filename" : "bitnagil_logo@2x.png", | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "filename" : "bitnagil_logo@3x.png", | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,29 +5,62 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Created by 최정인 on 7/27/25. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Lottie | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import SnapKit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import UIKit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public protocol SplashViewDelegate: AnyObject { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func splashView(_ sender: SplashView, isCompletedAnimated: Bool) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public final class SplashView: UIViewController { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private let splashGraphicView = UIImageView() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private enum Layout { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static let splashAnimationViewVerticalOffset: CGFloat = -20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static let splashAnimationViewSize: CGFloat = 205 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static let logoImageTopSpacing: CGFloat = -10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private var splashAnimationView = LottieAnimationView() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private let logoImage = UIImageView() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public weak var delegate: SplashViewDelegate? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| override public func viewDidLoad() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| super.viewDidLoad() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| configureAttribute() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| configureLayout() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| splashAnimationView.play { [weak self] completed in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let self else { return } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.delegate?.splashView(self, isCompletedAnimated: completed) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private func configureAttribute() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| splashGraphicView.image = BitnagilGraphic.introGraphic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let presentationBundle = Bundle(for: SplashView.self) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let filePath = presentationBundle.path(forResource: "splash", ofType: "json") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { return } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| splashAnimationView = LottieAnimationView(filePath: filePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| splashAnimationView.contentMode = .scaleAspectFit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| splashAnimationView.loopMode = .playOnce | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logoImage.image = BitnagilGraphic.logoGraphic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logoImage.contentMode = .scaleAspectFit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
38
to
48
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 리소스 로딩 에러 처리 개선 필요 현재 구현에서 몇 가지 개선점이 있습니다:
다음과 같이 개선하는 것을 고려해보세요: private func configureAttribute() {
let presentationBundle = Bundle(for: SplashView.self)
guard let filePath = presentationBundle.path(forResource: "splash", ofType: "json")
- else { return }
+ else {
+ print("Warning: splash.json file not found in bundle")
+ // fallback 처리 또는 기본 애니메이션 로직 추가
+ return
+ }
splashAnimationView = LottieAnimationView(filePath: filePath)
splashAnimationView.contentMode = .scaleAspectFit
splashAnimationView.loopMode = .playOnce
logoImage.image = BitnagilGraphic.logoGraphic
logoImage.contentMode = .scaleAspectFit
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private func configureLayout() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| view.backgroundColor = .systemBackground | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| view.addSubview(splashGraphicView) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| view.backgroundColor = .white | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| view.addSubview(splashAnimationView) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| view.addSubview(logoImage) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| splashAnimationView.snp.makeConstraints { make in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| make.centerX.equalToSuperview() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| make.centerY.equalToSuperview().offset(Layout.splashAnimationViewVerticalOffset) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| make.size.equalTo(Layout.splashAnimationViewSize) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| splashGraphicView.snp.makeConstraints { make in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| make.center.equalToSuperview() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logoImage.snp.makeConstraints { make in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| make.centerX.equalToSuperview() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| make.top.equalTo(splashAnimationView.snp.bottom).offset(Layout.logoImageTopSpacing) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
비동기 작업 처리가 적절하나 에러 핸들링 개선 필요
SplashViewDelegate 구현이 적절하고 @mainactor를 사용한 UI 업데이트도 올바릅니다. 하지만
reissueToken()작업에서 발생할 수 있는 예외에 대한 처리가 없습니다.다음과 같이 에러 핸들링을 추가하는 것을 고려해보세요:
Task { @MainActor in - let isLogined = await userDataRepository.reissueToken() - if isLogined { - window?.rootViewController = TabBarView() - } else { - let introView = IntroView() - let navigationController = UINavigationController(rootViewController: introView) - window?.rootViewController = navigationController - } + do { + let isLogined = await userDataRepository.reissueToken() + if isLogined { + window?.rootViewController = TabBarView() + } else { + let introView = IntroView() + let navigationController = UINavigationController(rootViewController: introView) + window?.rootViewController = navigationController + } + } catch { + // 토큰 재발급 실패 시 로그인 화면으로 이동 + let introView = IntroView() + let navigationController = UINavigationController(rootViewController: introView) + window?.rootViewController = navigationController + } }🤖 Prompt for AI Agents