iOS开发的一些基本概念
所属分类:ios | 发布于 2023-02-10 22:22:21
这是摘自medium上面的一篇文章的一部分,感觉讲的特别好,我也是研究了一天的打包之后,才发现这篇文章,一看,很多地方就豁然开朗了。文章内容很多,而且也比较老,这里选取一部分。
Workspace
A workspace is an Xcode doucument that groups projects
1、A workspace can contain any number of Xcode projects.
2、File in one Xcode project can be visible to Other project within a same workspace because By default, all the Xcode projects in a workspace are built in the same directory, referred to sa the worksapce build directory.
3、One Xcode project can be used by multiple workspace because each project in a workspace continues to have its own independent identify.
Xcode Project
An Xcode project is a repository for all the files, resources, and information required to build one or more software products
1、It contains one or more targets, which specify how to build product.(Extension, Unit and UITest)
2、A project defines default build settings for all the targets in the project(each target can also specify its own build settings, which override the project build settings).
3、You can specify more than one build configuration(DEBUG, RELEASE) for a project.
Xcode Target
A target specifies a product to build and contains the instructions for building the product form a set of files in a project or workspace
Target is a combination of inputs usually source files and resources and then instruction how to build thme and what to build them. A testing target can add bunch for tests that you can run and project contains one or more target. They can depend on your app target so when you run your unit test it has to build your app.
1、Each target defines a list of build settings for that project.
2、Each target also defines a list of classes, resources, custom scripts etc to include/usr when building.
Xcode Scheme
A build scheme is a blueprint for an entire build process, a way of telling Xcode what build configuations you want to use to create the development, unit test, and production builds for a given target(framework or app bundle).
1、You can have as many schemes as you want, but only one can be active at a time.
2、Schemes define configuation to use when building, and a collection of tests to execute.
3、One target should have at least one scheme.
Build Settings
Build setting are options for the build phases basically they are just bunch of variables when building a target
Configuations
Just a set of build settings so if you have a target which has build setting you can have a configuation which is another set of build settings usually way you get from xcode template debug and release configuations so you will notice that your app kind of gets build differently if you are debugging it form xcode vs archiving release.
Build Phases
Another part of target is build phases each target has a set of build phases, there are some build in ones like the compile the code plus you can create
You can create run script that can be a bash script, perl script, ruby script pretty much everything and do whatever you want that will be included as part of the build process. If you are familiar with makefile is kind of like that, if you want to run swiftlint maybe as part of your build process or a code formatter do some other stuff that maybe Xcode does not give out of the box, All build setting are available as environment variable within the script.