오늘은 Xcode의 Project와 Workspace에 대해 공부해봅시다.
Project
Project는 어플리케이션 개발의 기본 단위입니다. Project에는 어플리케이션을 빌드하는데 필요한 코드, 리소스(ex. 이미지, Storyboard, xib 등), 설정 파일(ex. plist.info 등), 메타데이터 등을 포함합니다. 여기에는 Target과 Scheme도 포함됩니다.
[iOS] Target & Scheme
Xcode의 Target과 Scheme에 대해 자세히 알아봅시다.Target과 Scheme을 통해서 Xcode의 빌드 및 실행 과정을 관리할 수 있습니다.각각 무엇을 세팅할 수 있고 어떻게 사용할 수 있는지 알아봅시다.TargetBuild
littlemoom.tistory.com
기본적으로 Project에 연결되는 파일들을 일반적인 파일시스템과 비슷하게 계층적인 구조로 이루어져있습니다.
하지만 Project는 여기서 한가지 특징을 갖습니다.
실제 파일 시스템 구조에 영향을 미치지 않고도, Project 내에서 자체적인 파일 구조를 갖을 수 있습니다.
예를 들면, 실제 파일 시스템에 폴더를 생성하지 않고도 Project 내 파일들의 그룹을 생성할 수 있습니다.
파일 추가 시에는 Copy, Move, Reference 중 한가지 옵션을 선택할 수도 있습니다.
Copy files to destination: 파일을 복사하여 Project에 가져옵니다. 원본은 유지되며, 지정한 폴더 내에 파일이 추가됩니다.
Move files to destination: 파일을 복사하지않고 Project에 가져옵니다. 원래 위치에서의 파일을 제거되며, 지정한 폴더 내에 파일이 추가됩니다.
Reference files in place: 파일을 참조하는 형태로 Project에 가져옵니다. 파일의 위치를 통해 참조하기 때문에 추가한 파일이 실제 파일 시스템에서 이동하거나 삭제되는 경우, 연결이 불가능합니다.
Project을 통해 내부 혹은 외부 Library 등 포함된 요소에 대한 관계를 유지할 수 있습니다.
다른 Project를 통해 빌드된 Library나 Framework 의존성을 설정할 수 있습니다.
또한 Carthage, SPM(Swift Package Manager)의 외부 Library 의존성 관리 도구를 지원합니다.
Workspace
Workspace는 여러 Project를 하나의 환경에서 관리할 수 있는 공간입니다.
원하는 수의 Project를 포함할 수 있고, 꼭 Project가 아니더라도 폴더나 파일을 추가할 수 있습니다.
각 Project의 Target들에 대해 명시적(explicit) 혹은 암묵적(implicit) 관계를 형성합니다.
이는 Project 간의 의존성을 설정하거나, Project 간의 파일 참조가 가능하다는 의미입니다.
최근에는 잘 사용되지 않지만, Cocoapods을 사용하면 Library에 의존되는 Project와 Pods Project가 하나로 묶여 Workspace가 자동으로 생성되었습니다.
Workspace는 여러개의 모듈을 동시에 개발하는 대규모 프로젝트에서 사용될 수 있습니다.
Project간의 의존성이 많을 경우나 Test Project가 별도로 존재하는 경우에도 유용하게 사용됩니다.
여러 Project에 공통되는 Library나 Framework가 있는 경우, 한 번의 빌드로 해당되는 모든 Project에 반영시킬 수 있습니다.
Reference
Projects and workspaces | Apple Developer Documentation
Manage the code and resources you use to build apps, libraries, and other software for Apple platforms.
developer.apple.com
Managing files and folders in your Xcode project | Apple Developer Documentation
Add new or existing files to your project, and use groups to organize the files and folders in the Project navigator.
developer.apple.com
Managing multiple projects and their dependencies | Apple Developer Documentation
Manage related projects in one place using a workspace, or configure build-time dependencies between different Xcode projects using cross-project references.
developer.apple.com
Xcode Project
Xcode Project An Xcode project is a repository for all the files, resources, and information required to build one or more software products. A project contains all the elements used to build your products and maintains the relationships between those elem
developer.apple.com
Xcode Workspace
Xcode Workspace A workspace is an Xcode document that groups projects and other documents so you can work on them together. A workspace can contain any number of Xcode projects, plus any other files you want to include. In addition to organizing all the fi
developer.apple.com
'iOS > iOS' 카테고리의 다른 글
[iOS] Swift Static Framework 만들기(Universal) - 2. XCFramework (1) | 2024.10.22 |
---|---|
[iOS] Target & Scheme (2) | 2024.09.30 |
[iOS] Xcode 15 Rosetta (0) | 2024.01.30 |
[iOS] CI/CD 환경 구축하기 - 2. fastlane match & CI/CD in Git Actions (0) | 2024.01.12 |
[iOS] CI/CD 환경 구축하기 - 1. Tuist in Git Actions & fastlane (0) | 2024.01.09 |