Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
80 changes: 67 additions & 13 deletions Wable-iOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

22 changes: 14 additions & 8 deletions Wable-iOS/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
)
)

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
guard let windowScene = (scene as? UIWindowScene) else { return }
self.window = UIWindow(windowScene: windowScene)

Expand All @@ -32,27 +36,29 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
self.configureLoginScreen()
}
} receiveValue: { isAutoLoginEnabled in
if isAutoLoginEnabled {
self.configureMainScreen()
} else {
self.configureLoginScreen()
}
isAutoLoginEnabled ? self.configureMainScreen() : self.configureLoginScreen()
}
.store(in: cancelBag)
}
}

// MARK: - Extension
// TODO: 각각 VC로 화면 이동하는 로직 구현 필요

private extension SceneDelegate {
// TODO: 로그인 화면으로 이동하는 로직 구현 필요
func configureLoginScreen() {
self.window?.rootViewController = ViewController()
self.window?.makeKeyAndVisible()
}

func configureMainScreen() {
self.window?.rootViewController = ViewController()
let condition = userSessionRepository.fetchActiveUserSession()?.notificationBadgeCount ?? 0 > 0

self.window?.rootViewController = TabBarController(
navigationView: NavigationView(
type: .home(hasNewNotification: condition)
)
)
self.window?.makeKeyAndVisible()
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,54 @@
//
// ScreenAdjustable.swift
// ConstraintMaker.swift
// Wable-iOS
//
// Created by 김진웅 on 3/4/25.
// Created by YOUJIM on 3/10/25.
//


import UIKit

/// `ScreenAdjustable` 프로토콜은 디바이스 화면 크기에 맞게 `CGFloat` 및 `Int` 값을 조정할 수 있도록 합니다.
///
/// - `adjusted`: 기준 너비(375pt)에 따라 조정된 값
/// - `adjustedHeight`: 기준 높이(812pt)에 따라 조정된 값
///
/// 이를 통해 다양한 디바이스에서 일관된 크기를 유지할 수 있도록 합니다.
///
/// 사용 예시:
/// ```swift
/// let width: CGFloat = 20.adjusted
/// let height: CGFloat = 40.adjustedHeight
/// ```
protocol ScreenAdjustable {
/// 기준 너비(375pt)를 기준으로 조정된 값
var adjusted: CGFloat { get }
import SnapKit

extension ConstraintMaker {
/// 너비 값을 설정할 때 자동으로 `adjustedWidth`를 적용하는 메서드입니다.
///
/// 기준 너비(375pt)에 따라 현재 기기의 화면 너비에 맞게 값을 조정합니다.
///
/// - Parameter float: 조정할 CGFloat 값
/// - Returns: ConstraintMakerEditable 객체
///
/// 사용 예시:
/// ```swift
/// view.snp.makeConstraints {
/// $0.adjustedWidthEqualTo(100) // $0.width.equalTo(100.adjustedWidth)와 같은 효과
/// }
/// ```
@discardableResult
func adjustedWidthEqualTo(_ float: CGFloat) -> ConstraintMakerEditable {
return self.width.equalTo(float.adjustedWidth)
}

/// 기준 높이(812pt)를 기준으로 조정된 값
var adjustedHeight: CGFloat { get }
/// 높이 값을 설정할 때 자동으로 `adjustedHeight`를 적용하는 메서드입니다.
///
/// 기준 높이(812pt)에 따라 현재 기기의 화면 높이에 맞게 값을 조정합니다.
///
/// - Parameter float: 조정할 CGFloat 값
/// - Returns: ConstraintMakerEditable 객체
///
/// 사용 예시:
/// ```swift
/// view.snp.makeConstraints {
/// $0.adjustedHeightEqualTo(200) // $0.height.equalTo(200.adjustedHeight)와 같은 효과
/// }
/// ```
@discardableResult
func adjustedHeightEqualTo(_ float: CGFloat) -> ConstraintMakerEditable {
return self.height.equalTo(float.adjustedHeight)
}
}

extension CGFloat: ScreenAdjustable {
extension CGFloat {
/// 기준 해상도에 대한 너비 비율 (기본값: 375pt)
private static let widthRatio: CGFloat = UIScreen.main.bounds.width / 375
Comment on lines -30 to 53
Copy link
Collaborator

Choose a reason for hiding this comment

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

extension의 영역이 fileprivate으로 제한된다면, 외부에서 CGFloat 값을 선언 후 사용할 때 adjusted 와 같은 내용을 몰라도 되어서 은닉화를 이룰 수 있을 것 같습니다만, 어떻게 생각하실까요?

fileprivate extension CGFloat {}

Copy link
Member Author

Choose a reason for hiding this comment

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

앗 제가 이 부분을 본문에 적어둔다는 걸 깜빡했네요 ...!! UIView 익스텐션의roundCorners 메서드에서 cornerRadius를 설정하는 부분을 adjustedWidth에 맞춰 변경했는데요. filePrivate 키워드를 사용하면 해당 익스텐션에서 adjustedWidth를 사용할 수 없기 때문에 키워드를 사용하지 않았습니다.

func roundCorners(_ corners: [Corner], radius: CGFloat) {
        layer.cornerRadius = radius.adjustedWidth
        layer.masksToBounds = true


Expand All @@ -42,7 +63,7 @@ extension CGFloat: ScreenAdjustable {
/// ```swift
/// let adjustedValue = 16.0.adjusted
/// ```
var adjusted: CGFloat {
var adjustedWidth: CGFloat {
return self * Self.widthRatio
}

Expand All @@ -59,7 +80,7 @@ extension CGFloat: ScreenAdjustable {
}
}

extension Int: ScreenAdjustable {
extension Int {
/// 현재 `Int` 값을 화면 너비에 맞게 조정합니다.
///
/// - Returns: `UIScreen.main.bounds.width`를 기준으로 계산된 크기
Expand All @@ -68,8 +89,8 @@ extension Int: ScreenAdjustable {
/// ```swift
/// let adjustedWidth = 20.adjusted
/// ```
var adjusted: CGFloat {
return CGFloat(self).adjusted
var adjustedWidth: CGFloat {
return CGFloat(self).adjustedWidth
}

/// 현재 `Int` 값을 화면 높이에 맞게 조정합니다.
Expand All @@ -84,3 +105,4 @@ extension Int: ScreenAdjustable {
return CGFloat(self).adjustedHeight
}
}

15 changes: 15 additions & 0 deletions Wable-iOS/Presentation/UIHelper/Enum/LottieType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// LottieType.swift
// Wable-iOS
//
// Created by YOUJIM on 3/9/25.
//


import Foundation

enum LottieType: String {
case tab = "wable_tab"
case loading = "wable_loading"
case splash = "wable_splash"
}
2 changes: 1 addition & 1 deletion Wable-iOS/Presentation/UIHelper/UIView+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extension UIView {
/// view.roundCorners([.topLeft, .topRight], radius: 10)
/// ```
func roundCorners(_ corners: [Corner], radius: CGFloat) {
layer.cornerRadius = radius
layer.cornerRadius = radius.adjustedWidth
layer.masksToBounds = true

var cornerMask: CACornerMask = []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// CommunityViewController.swift
// Wable-iOS
//
// Created by YOUJIM on 3/10/25.
//


import UIKit

final class CommunityViewController: UIViewController {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// HomeViewController.swift
// Wable-iOS
//
// Created by YOUJIM on 3/10/25.
//


import UIKit

final class HomeViewController: UIViewController {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// OverviewViewController.swift
// Wable-iOS
//
// Created by YOUJIM on 3/10/25.
//


import UIKit

final class OverviewViewController: UIViewController {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ProfileViewController.swift
// Wable-iOS
//
// Created by YOUJIM on 3/10/25.
//


import UIKit

final class ProfileViewController: UIViewController {

}
Loading