Skip to content

Commit

Permalink
[Chore] 아이콘 사용 방식 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
YoonAh-dev committed Oct 31, 2021
1 parent 8e57c9c commit 8d71a9d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
12 changes: 12 additions & 0 deletions CDSKit/Source/CDSBundle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// CDSBundle.swift
//
//
// Created by SHIN YOON AH on 2021/11/01.
//

import Foundation

internal class CDSBundle {
internal static let bundle = Bundle(for: CDSBundle.self)
}
15 changes: 11 additions & 4 deletions CDSKit/Source/Foundation/CDSIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ public enum CDSIcon {

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

0 comments on commit 8d71a9d

Please sign in to comment.