This project will be a base for all other projects, we will use it to initialize new projects, rather than creating a new project in Xcode each time.
Let’s start with a repository. Whether you work alone or with a team it’s a good practice to use a repository to handle all of the code. I use git and strongly suggest you to use it too. You can create a free account on GitHub or Bitbucket or even keep it as local repository.
After you have created a new repository, and before we generate a new project in Xcode, it’s a good idea to ignore some files using
.gitignore. Just in case you don’t know what it is, you can read more about it here.
We need to ignore a couple of unnecessary files from:
Now it’s time to start our journey with Xcode. I will be using the latest version of Xcode that is available at this moment, which is
Version 8.2.1 (8C1002).
Open Xcode and create New Project (⇧ ⌘ N):
Type the project name, choose Swift and check
Include Unit Tests:
Right now we have a plain simple iOS app. Let’s tweak it a little bit.
First of all, let’s rename tests target. To do this, click iOSProjectStarter project inside Project navigator, then inside targets double click
iOSProjectStarterTests and rename it to
Unfortunately, this will not rename the directory with tests, we have to do this manually. Delete
iOSProjectStarterTests from Project navigator:
Instead of deleting it, just
Rename the directory in Finder:
Now drag and drop it into Project navigator:
Copy items if needed as files are already there. Just select appropriate target:
Now when you try to build project
⌘B, you should see an error:
That’s because in settings, there is an old path to Info.plist file which is linking to the old test directory. To change it simply open
iOSProjectStarterSpec target and inside
Build Settings look for
Info.plist. Change the path from
Right now you will be able to build the project, but there is a warning:
To fix it, go to target
Build Phases and remove
Copy Bundle Resources section:
And that’s all for this part, the project should compile without any warnings.
In the next step we will add additional libraries using Cocoapods.