Skip to content

Commit

Permalink
[NON_ISSUE] Bundle 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
chongin12 committed Aug 14, 2023
1 parent 68b0600 commit 60019b9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
7 changes: 3 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ let package = Package(
.product(name: "PanModal", package: "PanModal"),
.product(name: "SnapKit", package: "SnapKit"),
.product(name: "Parchment", package: "Parchment"),
.targetItem(name: "YDS-Essential", condition: .none)
.target(name: "YDS-Essential", condition: .none)
],
path: "YDS/Source"
),
.target(
name: "YDS-SwiftUI",
dependencies: [
.targetItem(name: "YDS-Essential", condition: .none)
.target(name: "YDS-Essential", condition: .none)
],
path: "YDS-SwiftUI/Source"
),
Expand All @@ -48,8 +48,7 @@ let package = Package(
dependencies: [],
path: "YDS-Essential/Source",
resources: [
.process("Foundation/YDSIcon.xcassets"),
.process("Foundation/YDSBasicColor.xcassets")
.process("Foundation")
]
)
]
Expand Down
15 changes: 14 additions & 1 deletion YDS-Essential/Source/YDSBundle.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// YDSBundle.swift
// YDS-SwiftUI
// YDS-Essential
//
// Created by 정종인 on 2023/07/30.
//
Expand All @@ -10,3 +10,16 @@ import Foundation
public class YDSBundle {
public static let bundle = Bundle(for: YDSBundle.self)
}
#if SWIFT_PACKAGE
public extension Bundle {
static var ydsEssential: Bundle {
return .module
}
}
#else
public extension Bundle {
static var ydsEssential: Bundle {
return Bundle(for: YDSBundle.self)
}
}
#endif
9 changes: 1 addition & 8 deletions YDS/Source/Foundation/YDSBasicColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -705,17 +705,10 @@ internal extension UIColor {

fileprivate extension UIColor {
static func load(name: String) -> UIColor {
#if SWIFT_PACKAGE
guard let color = UIColor(named: name, in: .module, compatibleWith: nil) else {
guard let color = UIColor(named: name, in: .ydsEssential, compatibleWith: nil) else {
assert(false, "\(name) 컬러 로드 실패")
return UIColor.clear
}
#else
guard let color = UIColor(named: name, in: YDSBundle.bundle, compatibleWith: nil) else {
assert(false, "\(name) 컬러 로드 실패")
return UIColor.clear
}
#endif
return color
}
}
9 changes: 1 addition & 8 deletions YDS/Source/Foundation/YDSIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,10 @@ public enum YDSIcon {

extension UIImage {
fileprivate static func load(name: String) -> UIImage {
#if SWIFT_PACKAGE
guard let image = UIImage(named: name, in: .module, compatibleWith: nil) else {
guard let image = UIImage(named: name, in: .ydsEssential, compatibleWith: nil) else {
assert(false, "\(name) 이미지 로드 실패")
return UIImage()
}
#else
guard let image = UIImage(named: name, in: YDSBundle.bundle, compatibleWith: nil) else {
assert(false, "\(name) 이미지 로드 실패")
return UIImage()
}
#endif
image.accessibilityIdentifier = name
return image
}
Expand Down

0 comments on commit 60019b9

Please sign in to comment.