Swift iOS 24-Hour Trainer. Mishra Abhishek. Читать онлайн. Newlib. NEWLIB.NET

Автор: Mishra Abhishek
Издательство: John Wiley & Sons Limited
Серия:
Жанр произведения: Зарубежная образовательная литература
Год издания: 0
isbn: 9781119073420
Скачать книгу
and Installing

You can download and install Xcode 7 for Mac OS X El Capitan and the iOS SDK from the Mac App Store (see Figure 1.2).

Figure 1.2

      If you have a paid membership, you can download the latest version of Xcode as well as prior versions by logging in to the iOS developer portal at https://developer.apple.com/devcenter/ios/index.action.

      The Typical App Development Process

Whether you intend to develop iOS apps yourself or manage the development of one, you need to be familiar with the basic steps in the development process (see Figure 1.3). This section introduces these steps briefly.

Figure 1.3

      Writing a Specification

      The development of an app begins with a concept. It is good practice to formally put this concept on paper and create a specification. You do not necessarily need to type this specification, although it's a good idea to do so.

      At the end of the project you should come back to the specification document to see how the final product that was created compares with the original specification.

      As you build your experience developing iOS applications, this difference will become smaller. The specification must address the following points:

      • A short description in 200 words or less

      • The target audience/demographic of the users

      • How will it be distributed (App Store, or direct to a small number of devices)

      • A list of similar competing apps

      • A list of apps that best illustrate the look-and-feel your app is after

      • The pricing model of competing apps and potential pricing for your app

      Wireframes and Design

      A wireframe is a large drawing that contains mockups of each screen of your app as well as lines connecting different screens that indicate the user's journey through your application.

      Wireframes are important because they can help identify flaws in your design early on (before any coding has been done). They can also be used to show potential clients how a particular app is likely to look when it's completed.

      There is no right or wrong way to make a wireframe. If it is for your personal use, you can just use a few sheets of paper and a pen. If it is for a client, you might want to consider using an illustration package.

      Coding

      The actual process of creating an iOS app involves using the Xcode IDE to type your code. iOS apps can be written in either Swift or Objective-C. This book covers iOS development with Swift only.

      An iOS app typically consists of several files of Swift code along with resource files (such as images, audio, and video). These individual files are combined together by a process called compilation into a single file that is installed onto the target device. This single file is usually referred to as the application binary or a build.

      Testing

      It might sound obvious, but you must test your app after it has been developed. As a developer, you test your code frequently as you write it. You must also perform a comprehensive test of the entire application as often as possible to ensure things that were working in the past continue to do so. This form of testing is called regression testing. It helps to make a test plan document. Such a document basically lists all the features that you want to test and the steps required to carry out each test. The document should also clearly list which tests failed. The ones that fail will then need to be fixed and the test plan document can provide the replication procedure for the defect in question.

      When your app is ready, you will want to list it in the iTunes App Store. To do so involves submitting your app for review to Apple. Apple has several criteria against which it reviews applications and if your app fails one or more of these criteria it will be rejected – in which case you will need to fix the appropriate code and resubmit. It is best to test your apps thoroughly before submitting them in the first place. Distributing your apps via the App Store is covered in Appendix D.

      You must always test on a real iOS device before submitting your app for the App Store review process, or giving it to a client to test. Testing on the iOS Simulator alone is not sufficient.

      If you are developing for a client, you will probably need to send the client a testable version of your work periodically for review. The recommended way to do this is by using Apple's TestFlight service, which is covered in Appendix C.

      Home Screen Icon

Unless you provide an icon for your application, iOS will use a standard gray icon to represent your application in the home screen (see Figure 1.4).

Figure 1.4

To replace this icon, you will need to provide one or more PNG files with appropriate dimensions. These dimensions are listed in Table 1.1 and are different for iPhone-based and iPad-based applications.

Table 1.1 Home Screen Icon Sizes

      You learn to use these icons in this lesson's Try It section.

      Application Launch Image

      A launch image is a placeholder image that you must provide as part of your iOS application. When a user taps your application's icon on the home screen, iOS displays this image while the app starts up.

      Once your application has finished loading, iOS gives it control and simultaneously hides the launch image. The overall effect of the launch image is to give your users the perception that your application has launched quickly.

      NOTE

      The launch image provided as part of your application may not always be used. When an app is suspended into the background state (perhaps because the user tapped the home button on the device), iOS creates a snapshot of the current screen before suspending the app. If the app is resumed within a short period of time then this cached image is used in place of the launch image. However, if the user killed the app, uninstalled it, or hasn't used the app for an extended period of time then the launch image will be used.

      Prior to iOS8, as a developer you had to provide a static PNG version of the launch image for every screen size and orientation that was supported by your app.

      While it is still possible to provide static launch images, with the launch of iOS 8 Apple has introduced the concept of a single launch file. A launch file is an XIB (or a storyboard file) that describes the user interface for the launch image. An empty document called LaunchScreen.storyboard is provided with every iOS project that you create.

      The idea behind providing a single launch file over several individual launch images is that iOS will generate the launch images it needs from the launch file for the device on which the app is being used.

      You learn to use a launch file in this lesson's Try It section.

      TRY IT

      In