Skip to content

Conversation

@LeeYeJi546
Copy link
Contributor

@LeeYeJi546 LeeYeJi546 commented Jan 4, 2026

✨ PR 유형

스크린샷 2026-01-04 오후 3 14 55

🛠️ 작업내용

커밋 히스토리

  • feat: LoadingView 구현: 로딩뷰 컴포넌트 제작
  • refactor: LoadingViewModifier 최소화: LoadingView에서는 EnvironmentKey 사용이 불필요하다고 판단하여 최소화하여 리팩토링함

📋 추후 진행 상황

📌 리뷰 포인트

✅ Checklist

PR이 다음 요구 사항을 충족하는지 확인해주세요!!!

Summary by CodeRabbit

  • New Features
    • Added a new loading overlay component with customizable messages and typography.
    • Supports two configurable size options (small and large) with different dimensions and fonts.
    • Loading overlay visibility, messages, and sizing can be controlled through environment settings.
    • Includes optimized re-rendering that updates the overlay only when message or size properties change.

✏️ Tip: You can customize this high-level summary in your review settings.

@LeeYeJi546 LeeYeJi546 linked an issue Jan 4, 2026 that may be closed by this pull request
1 task
@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

📝 Walkthrough

Walkthrough

Introduces a new LoadingView SwiftUI component system consisting of a generic overlay wrapper, environment configuration for presentation state and messaging, view modifiers for fluent API chaining, and a size enumeration with predefined dimensions.

Changes

Cohort / File(s) Change Summary
LoadingView Component Core
AppProduct/.../LoadingView/LoadingView.swift, AppProduct/.../LoadingView/LoadingViewSize.swift
New generic LoadingView<Content> struct that wraps content and conditionally displays an overlay with ProgressView and message; conforms to AnyLoadingView. New LoadingViewSize enum with small and large cases, each defining a CGSize and Font. Includes SwiftUI Preview demonstrating overlay behavior.
LoadingView Configuration
AppProduct/.../LoadingView/LoadingViewEnvironment.swift
Three new EnvironmentKey types (LoadingViewSizeKey, LoadingViewIsPresentedKey, LoadingViewMessageKey) with defaults (.large, false, "Loading..."). Extension on EnvironmentValues adds computed properties for accessing/setting these keys.
LoadingView Modifiers & API
AppProduct/.../LoadingView/LoadingViewModifier.swift
New AnyLoadingView protocol extending View. Three ViewModifier implementations (LoadingViewSizeModifier, LoadingViewIsPresentedModifier, LoadingViewMessageModifier) propagate configuration via environment. Extension on AnyLoadingView provides fluent API methods: loadingSize(_), presented(_), loadingMessage(_).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • ✨ Feature: LoadingView 제작 #9: Directly implements the LoadingView component feature, including ProgressView overlay, environment-based configuration, modifiers with fluent API, and size presets as requested.

Poem

🐇 A loading view hops into view,
With progress spinning round and true,
Environment whispers messages sweet,
Modifiers make the API complete!
Small or large, this overlay's neat!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: implementation of a LoadingView component, which matches the actual changeset that introduces LoadingView with size, environment, and modifier configurations.
Description check ✅ Passed The description includes a screenshot, commit history, and completed checklist items following the template structure, though the review points and follow-up sections remain empty.
✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@LeeYeJi546 LeeYeJi546 added the ✨ Feature 새로운 기능을 추가합니다. label Jan 4, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingViewEnvironment.swift (1)

10-41: Well-structured environment key definitions.

The implementation follows SwiftUI's standard pattern for custom environment values. The separation into distinct keys for size, presentation state, and message provides flexibility.

Consider using LocalizedStringKey or String(localized:) for the default message if localization is planned:

 struct LoadingViewMessageKey: EnvironmentKey {
-    static let defaultValue: String = "Loading..."
+    static let defaultValue: String = String(localized: "Loading...")
 }
AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingView.swift (2)

51-62: Minor formatting issue and UX consideration.

Line 55 has an extra space before the comma. Additionally, consider adding a semi-transparent background overlay to prevent user interaction with content during loading:

🔎 Proposed improvements
     var body: some View {
         VStack(spacing: 10) {
             ProgressView()
                 .progressViewStyle(.circular)
-                .frame(width: size.size.width , height: size.size.height)
+                .frame(width: size.size.width, height: size.size.height)
             
             if let message {
                 Text(message)
                     .font(size.font)
             }
         }
+        .frame(maxWidth: .infinity, maxHeight: .infinity)
+        .background(Color.black.opacity(0.3))
     }

72-81: Preview demonstrates basic usage.

Consider adding additional preview variants to showcase different configurations (e.g., small size, no message, custom message):

#Preview("Loading Small") {
    LoadingView {
        Text("Content")
    }
    .loadingSize(.small)
    .loadingMessage("Please wait...")
    .presented(.constant(true))
}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea42d48 and 648d191.

📒 Files selected for processing (4)
  • AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingView.swift
  • AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingViewEnvironment.swift
  • AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingViewModifier.swift
  • AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingViewSize.swift
🧰 Additional context used
🧬 Code graph analysis (2)
AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingViewSize.swift (1)
AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingViewModifier.swift (3)
  • body (22-24)
  • body (30-32)
  • body (38-40)
AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingView.swift (1)
AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingViewModifier.swift (4)
  • body (22-24)
  • body (30-32)
  • body (38-40)
  • presented (54-56)
🔇 Additional comments (3)
AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingView.swift (1)

12-39: Good component structure with environment-based configuration.

The use of @Environment for reactive state propagation and the Equatable conformance on LoadingViewContent for render optimization are well-implemented SwiftUI patterns.

AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingViewModifier.swift (1)

19-41: Clean ViewModifier implementations.

The modifiers correctly propagate values to the SwiftUI environment. The use of @Binding in LoadingViewIsPresentedModifier allows for two-way binding if needed in the future.

AppProduct/AppProduct/Core/Common/UIComponents/LoadingView/LoadingViewSize.swift (1)

10-34: Clean enum design for loading view sizing.

The enum provides a scalable structure for size and typography configuration. Since enums without associated values are implicitly Equatable in Swift, the comparison in LoadingViewContent will work correctly. The custom .app(_:weight:) font extension is properly defined in the design system tokens.

Comment on lines 45 to 61
extension AnyLoadingView {

/// 로딩 사이즈 설정
/// - Parameter size: small, large
func loadingSize(_ size: LoadingViewSize) -> some View {
self.modifier(LoadingViewSizeModifier(size: size))
}

/// 로딩 isPresented
func presented(_ isPresented: Binding<Bool>) -> some View {
self.modifier(LoadingViewIsPresentedModifier(isPresented: isPresented))
}

/// 로딩 메시지 설정
func loadingMessage(_ message: String) -> some View {
self.modifier(LoadingViewMessageModifier(message: message))
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Modifier chaining limitation due to return type.

The modifiers return some View instead of preserving the AnyLoadingView conformance, which breaks fluent API chaining. After calling one modifier, subsequent AnyLoadingView-specific modifiers won't be available.

For example, this won't compile:

LoadingView { Text("Content") }
    .loadingSize(.small)
    .presented(.constant(true)) // Error: 'some View' has no member 'presented'

Consider one of these solutions:

🔎 Option 1: Move modifiers to a View extension (simpler)
-extension AnyLoadingView {
+extension View {
     
     /// 로딩 사이즈 설정
     /// - Parameter size: small, large
     func loadingSize(_ size: LoadingViewSize) -> some View {
-        self.modifier(LoadingViewSizeModifier(size: size))
+        modifier(LoadingViewSizeModifier(size: size))
     }
     
     /// 로딩 isPresented
     func presented(_ isPresented: Binding<Bool>) -> some View {
-        self.modifier(LoadingViewIsPresentedModifier(isPresented: isPresented))
+        modifier(LoadingViewIsPresentedModifier(isPresented: isPresented))
     }
     
     /// 로딩 메시지 설정
     func loadingMessage(_ message: String) -> some View {
-        self.modifier(LoadingViewMessageModifier(message: message))
+        modifier(LoadingViewMessageModifier(message: message))
     }
 }
🔎 Option 2: Use wrapper types to preserve AnyLoadingView conformance

This approach is more complex but preserves the type constraint if that's important for your API design.

@JEONG-J
Copy link
Contributor

JEONG-J commented Jan 4, 2026

@LeeYeJi546 화면 전체를 감싸는 로딩 뷰를 생각하고 만든거라면, overlay 방식으로 처리할 수 있도록 해봐요
즉, modifier로 해당 뷰의 컨텐츠에 로딩 뷰가 있기를 원한다면 modifier를 불러오면 되는거죠
지금 방식은 뷰 빌더로 Container로 사용하도록 되어 있어요! 뷰끼리 체인이 너무 걸려 버리는 단점이 있기에 로딩뷰의 설게 방식은 완전 좋지 못하다고 얘기를 하고 싶네요

사용할 때 마다 로딩 텍스트를 입력하고 등장 시키는게 아닌, 로딩 뷰가 앱 전체에서 사용될 모든 로딩 텍스트를 관리할 수 있도록 내부에 enum을 배치하고, 외부에서는 case를 선택해서 사용만 할 수 있도록 하는거죠

또 프로그레스 뷰의 size 조절은 controlSize로 하는거요! frame으로 size 조절이 아닙니다!

해당 내용을 잘 적용해서 답에 가깝게 수정이 안되고, pr로 또 올라온다면 그냥 제가 바꿔두도록 할게요!
좋은 설계가 뭔지 힌트를 주었으니 바꿔 보세요

Copy link
Contributor

@jwon0523 jwon0523 left a comment

Choose a reason for hiding this comment

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

코드에 달아둔 리뷰 확인해서 수정해주세요!
제웅이 리뷰한 내용과 함께 확인해서 반영해주면 됩니당

Comment on lines 20 to 22
struct LoadingViewMessageKey: EnvironmentKey {
static let defaultValue: String = "Loading..."
}
Copy link
Contributor

Choose a reason for hiding this comment

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

LodingView.swift에서 43번째 줄에서는 옵셔널로 받고 있는데, 해당 키에서 기본값으로 'Loading...'으로 명시해두면 LodingView.swift에서 옵셔널로 선언한 의미가 없어 보입니다.
제 생각에는 LoadingViewMessage는 Modifier로 제공하는 것보다 기본 파라미터를 옵셔널로 하는 것이 좋을거 같습니다! 해당 컴포넌트에서는 필수적인 기능이니까요

Copy link
Contributor

Choose a reason for hiding this comment

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

머져 내 닉네임 제.옹. 입.니.다.만. ^^ ㅋㅋㅋㅋㅋㅋ

Copy link
Contributor

Choose a reason for hiding this comment

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

앗..오타 스미마셍 ㅋㅎㅋㅎㅋㅎㅋㅎㅋㅎ

VStack(spacing: 10) {
ProgressView()
.progressViewStyle(.circular)
.frame(width: size.size.width , height: size.size.height)
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 부분은 controlSize() 수정자를 사용해서 아래와 같이 작성하는게 좋을거 같아요

Suggested change
.frame(width: size.size.width , height: size.size.height)
.controlSize(size == .large ? .large : .small)

Copy link
Contributor

@JEONG-J JEONG-J left a comment

Choose a reason for hiding this comment

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

따봉

@JEONG-J JEONG-J merged commit 9335c91 into develop Jan 10, 2026
@JEONG-J JEONG-J deleted the feat/LoadingView branch January 10, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 새로운 기능을 추가합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Feature: LoadingView 제작

4 participants