Book Image

Swift 2 Blueprints

By : Cecil Costa
Book Image

Swift 2 Blueprints

By: Cecil Costa

Overview of this book

In this book, you will work through seven different projects to get you hands-on with developing amazing applications for iOS devices. We start off with a project that teaches you how to build a utility app using Swift. Moving on, we cover the concepts behind developing an entertainment or social networking related application, for example, a small application that helps you to share images, audio, and video files from one device to another. You’ll also be guided through create a city information app with customized table views, a reminder app for the Apple Watch, and a game app using SpriteKit. By the end of this book, you will have the required skillset to develop various types of iOS applications with Swift that can run on different iOS devices. You will also be well versed with complex techniques that can be used to enhance the performance of your applications.
Table of Contents (15 chapters)
Swift 2 Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Versioning your project


Every project should have a version control system, even if you are the only developer. Xcode works with Git as a default VCS, which has a special way of working.

Firstly, you have to know that Xcode offers you just the basic usage of Git; there are times when you might need to use the command line.

You can use Git in two ways: locally only or remote and locally. The first one is usually done by single developers and can be done very easily by checking this option when you have to select a folder for your new project. The following screenshot shows the option that needs to be checked in the file dialog:

The second way of working with Git is to use it remotely and locally. What does it mean? It means that you can create versions of your code locally and when you think that it is ready to be shared with the other members of the team, you can send it to the server. To do so, you have to configure a server by yourself or you can use this service from a third-party company, such as GitHub or BitBucket.

Note

Recently, Apple announced the Xcode server, where you can configure your Git server and also a continuous integration system. Explaining how to configure this server can be very exhausting and is out of the scope of this book. However, if you would like to create your own server, you can have a look at this possibility.

As a developer what you need to work with a remote repository is its URL. You have to request it to the system administrator or you can copy it from the website where you created it. GitHub, for example, shows it on the right-hand side with a button to copy the URL on the clipboard, as you can see in the following screenshot:

Once you have the URL, you can check it out by selecting the Check out an existing project option on the start up screen, as shown in the following screenshot. Or, you can click on the Source Control menu and select the Check out... option.

Once you have your project checked out and have started working on it, it doesn't matter whether it was created from a server or locally only. You will notice that when a file is modified, letter M will appear next to your file name on the project navigator. Letter A will also appear when a new file is added to the project. The next screenshot shows a sample of some files that were added or modified:

Note that letter M can also appear next to your project; it means that something in the project.pbxproj file, which is inside of your project package. This file contains the information of your project like the source code files with their path and the settings; hence, you have to deliver it every time you add a file or change any setting.

To commit the modified and new files, you just need to use the command + option + C key combination. A dialog asking for a description of the modifications will appear, leave a message in a way that another developer understands what was done.

Tip

Avoid committing without leaving a comment, or just leaving a nonexpressive comment like "modifications." Comments are very useful to check the project's progress and fix bugs.

These commits are done locally by default. It means that only your computer knows about your modifications. If you want to send your commits to the server, don't forget to check the option that is under the comment box, as it is demonstrated in the next screenshot:

The other way around, which means receiving updates from the server, is called pull. To do a pull from the server, you just need to press the command + option + X combination key.