728x90
안녕하세요.
Xcode Asset에 Namespace 설정할 수 있다는 것 알고 계셨나요?
아주 간단하니 빠르게 살펴볼게요.
Assets에서 폴더 선택 후 Provides Namespace 체크박스를 클릭하면 Namespace를 설정할 수 있어요.

코드에선 이렇게 이름에 Namespace까지 포함시켜줘야 합니다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
var body: some View { | |
Image("Image/profile") // ✅ | |
.padding() | |
} | |
} |
또한, 중첩된 폴더 하나하나 마다 Namespace를 설정해줄 수 있습니다.

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
var body: some View { | |
Image("Image/Profile/profile") // ✅ | |
.padding() | |
} | |
} |
이번 글은 여기서 마무리.
반응형
'Xcode' 카테고리의 다른 글
Copyright 문구 제거 (1) | 2023.01.24 |
---|---|
Xcode Custom File Template 만드는 방법 (0) | 2023.01.17 |
Xcode 14 Release Notes (0) | 2022.07.03 |
Xcodes.app (0) | 2022.04.03 |
Xcode 13.3에서 Swift 프로젝트 빌드 속도를 더 빠르게 (0) | 2022.03.21 |