Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions Projects/App/Resources/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,8 @@
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PLm-O2-pYg">
<rect key="frame" x="20" y="259" width="353" height="334"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Bitnagil" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dEo-10-Cez">
<rect key="frame" x="123" y="149" width="107" height="36"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="30"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.76078431372549016" green="0.76862745098039209" blue="0.78431372549019607" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="dEo-10-Cez" firstAttribute="centerX" secondItem="PLm-O2-pYg" secondAttribute="centerX" id="Tfr-eg-2qd"/>
<constraint firstItem="dEo-10-Cez" firstAttribute="centerY" secondItem="PLm-O2-pYg" secondAttribute="centerY" id="dWo-st-RGp"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="PLm-O2-pYg" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="9cn-j0-5Zm"/>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="trailing" secondItem="PLm-O2-pYg" secondAttribute="trailing" constant="20" id="Buq-td-Lm2"/>
<constraint firstItem="PLm-O2-pYg" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" constant="20" id="E9P-56-2M2"/>
<constraint firstItem="PLm-O2-pYg" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="SbZ-Sq-Opn"/>
<constraint firstItem="PLm-O2-pYg" firstAttribute="top" secondItem="Bcu-3y-fUS" secondAttribute="top" constant="200" id="dic-7N-u8I"/>
<constraint firstItem="PLm-O2-pYg" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="hlQ-mO-iXo"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down
1 change: 1 addition & 0 deletions Projects/Presentation/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let project = Project(
dependencies: [
.external(name: "SnapKit"),
.external(name: "Kingfisher"),
.external(name: "Lottie"),
.project(target: "Domain", path: "../Domain"),
.project(target: "Shared", path: "../Shared")
]
Expand Down
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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Projects/Presentation/Resources/splash.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ enum BitnagilGraphic {
static let introGraphic = UIImage(named: "intro_graphic", in: bundle, with: nil)
static let onboardingGraphic = UIImage(named: "onboarding_graphic", in: bundle, with: nil)
static let defaultEmotionGraphic = UIImage(named: "default_emotion_graphic", in: bundle, with: nil)
static let logoGraphic = UIImage(named: "bitnagil_logo", in: bundle, with: nil)
}
37 changes: 31 additions & 6 deletions Projects/Presentation/Sources/Common/View/SplashView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,54 @@
// Created by 최정인 on 7/27/25.
//

import Lottie
import SnapKit
import UIKit

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()

override public func viewDidLoad() {
super.viewDidLoad()
configureAttribute()
configureLayout()
splashAnimationView.play()
}

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

리소스 로딩 에러 처리 개선 필요

현재 구현에서 몇 가지 개선점이 있습니다:

  1. splash.json 파일을 찾지 못할 경우 silent failure가 발생합니다
  2. 에러 상황에 대한 적절한 처리나 로깅이 없습니다

다음과 같이 개선하는 것을 고려해보세요:

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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
}
private func configureAttribute() {
let presentationBundle = Bundle(for: SplashView.self)
guard let filePath = presentationBundle.path(forResource: "splash", ofType: "json")
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
}
🤖 Prompt for AI Agents
In Projects/Presentation/Sources/Common/View/SplashView.swift around lines 30 to
40, the code silently fails if the splash.json resource is not found and lacks
error handling or logging. Modify the guard statement to handle the failure case
explicitly by logging an error message or providing fallback behavior to inform
about the missing resource, ensuring the app does not fail silently.


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)
}
}
}
9 changes: 9 additions & 0 deletions Tuist/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tuist/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/SnapKit/SnapKit.git", from: "5.0.0"),
.package(url: "https://github.com/kakao/kakao-ios-sdk", from: "2.23.0"),
.package(url: "https://github.com/onevcat/Kingfisher.git", from: "8.0.0")
.package(url: "https://github.com/onevcat/Kingfisher.git", from: "8.0.0"),
.package(url: "https://github.com/airbnb/lottie-ios", from: "4.0.0")
]
)
Loading