Introduction
This is part of a series of articles detailing the creation of a simple iOS app. A complete list of articles is included in the first part A Simple Swift iOS App from Start to Finish - Introduction.
I have set up a web site for the finished app at http://DaysWithoutThings.com and you can download it free directly from the app store:
My ‘Days Without Things’ app will be a universal app that will run on both iPhone and iPad and will consist of one launch screen, five views, and one data source. I’m going create it using the Swift programming language in Xcode 6.
Creating The Project
I’ll start by opening Xcode 6 and creating a new project. There are two ways to do this. I could click ‘Create a new Xcode project’ in the launch window or I can click File - New - Project from the main menu.
After I click 'Create' I am left looking at the main Xcode window with my new project displayed in the project navigator on the left edge of the window.
Project Files
The Single View Application template creates the following files automatically:
AppDelegate.swift
This is a Swift class file that contains the definition for the AppDelegate class. This class is used to create a singleton object that is availably globally through out the app and provides an interface to the key events in the apps executions. As I checked the Core Data option the AppDelegate also contains the code to initialize and access the apps local core data store.
ViewController.swift
This is another Swift class. It holds the code for the application's view.
Main.storyboard
This is the project's Interface Builder file. It currently contains just the blank definition for the app's view.
Images.assets
This is a resource file that contains placeholders for the app's Icon artwork.
LaunchScreen.xib
This is an Interface Builder file that contains the definition for the default launch screen.
Days_Without_Things.xcdatamodel
This is the app's Core Data model file.
Running the App
Before I proceed any further I’m going to test the app in the iOS emulator. To do this I select ‘iPhone 6’ from the device list and click the play button.Once the app finishes loading it displays its main view which is currently just a blank white screen.
To test it also works for the iPad I am going to change the device type to ‘iPad 2’. I can then click play again and the iOS Simulator will change to displaying my app in its iPad emulation.
Wrapping up
I have now created my project and tested that it runs.
Next: A Simple Swift iOS App from Start to Finish - Using Source Control in Xcode 6
No comments:
Post a Comment