Swift iOS 24-Hour Trainer. Mishra Abhishek

Читать онлайн.
Название Swift iOS 24-Hour Trainer
Автор произведения Mishra Abhishek
Жанр Зарубежная образовательная литература
Серия
Издательство Зарубежная образовательная литература
Год выпуска 0
isbn 9781119073420



Скачать книгу

will receive an e-mail with information describing how to verify your account and complete the joining process.

      NOTE

      You can read messages in the forums without joining P2P, but in order to post your own messages, you must join.

      Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the Web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.

      For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.

      Section I

      Hello iOS!

Lesson 1

      Hello iOS!

      Hello and welcome to the exciting world of iOS application development. iOS is Apple's operating system for mobile devices; the current version at the time of this writing is 8.0. It was originally developed for the iPhone (simply known as iPhone OS back then), and was subsequently extended and renamed in June 2010 to iOS to support the iPad, iPhone, and iPod Touch.

      At its core, iOS is Unix-based and has its foundations in MacOS X, which is Apple's desktop operating system. In fact, both iOS and MacOS X share a common code base. As new versions of mobile operating systems have appeared, Apple has brought over more functionality from MacOS X. This is part of Apple's strategy to bridge the difference between desktop and mobile computing.

      With the launch of version 8.0, Apple has not only pushed the boundaries on what is achievable on smart phones and tablet computers, but has also given us a brand new programming language called Swift. This book covers iOS development with Swift only, but at the time of this writing, it is possible to create iOS applications with both the older language Objective-C as well as Swift.

      This lesson introduces you to the arena of iOS development.

      iOS Developer Essentials

      Before you get started on your journey to becoming an iOS developer, you will need some essential resources. This section covers these basic requirements.

      A Suitable Mac

      To develop apps for the iPhone and the iPad using the official set of tools provided by Apple, you will first need an Intel-based Mac running Mac OS X Yosemite (10.10) with a minimum 4GB of RAM and at least 11GB of free space on your hard disk. You do not need a top-spec model to get started. In fact a Mac Mini or a low-end MacBook will work just fine.

      Processor speed is not going to make much difference to you as a developer. You will be better off investing your money in more RAM and hard disk space instead. These are things you can never get enough of. A large screen does help, but it is not essential.

      A Device for Testing

      If you are reading this book, chances are that you have used an iPhone, iPad, or iPod Touch and probably even own one or more of these nifty devices.

      As far as development is concerned, there aren't many differences between developing for any of these devices. The obvious differences are screen size and the fact that only iPhones can make phone calls. When you are starting out as an iOS developer, you will test your creations on the iOS Simulator. The iOS Simulator is an application that runs on your Mac and simulates several functions of a real iOS device (more on this later).

      At some point, however, you will want to test your apps on a physical device. As good as the iOS Simulator may be, you must test on a physical device before submitting your app to the App Store.

      Another good reason to test on a physical device is that the processor on your Mac is much faster than that on the iPhone/iPad. Your app may appear to execute much faster on your Mac (in the iOS Simulator) than it does on the real thing.

      If the app you are going to make is targeted at iPhone users, you can also use an iPod Touch as the test device. These are significantly cheaper than iPhones and for the most part offer the same functionality as their phone counterparts.

      Most of Apple's devices support iOS 8; however, iOS 8 is not supported for the following:

      • iPhones prior to the iPhone 4S

      • iPads prior to the iPad 2

      • iPod Touch devices prior to the iPod Touch 5th generation

      An iOS Developer Account

      To develop your apps you will need to download the latest version of Xcode and the iOS SDK (Software Development Kit). To do this, you must sign up to the Apple Developer Program to become a registered developer.

      The signup process is free and you can immediately begin to develop your first apps. Limitations exist as to what you can do for free. To submit your apps to the App Store, get access to beta versions of the iOS/SDK, or test your apps on a physical device, you need to become a paying member.

      Most of the concepts and apps presented in this book will work just fine with the free membership. The only exceptions would be examples that require the camera, accelerometer, and GPS for which you would need to try the app on a physical device.

      You can choose from two forms of paid membership as a registered Apple Developer: Individual and Enterprise.

      Individual

      The Individual iOS Developer Program costs $99 a year and is for individuals or companies that want to develop apps that will be distributed through the App Store. You can also test/distribute your apps on up to 100 devices without having to go through the App Store. This form of deployment (without having to submit them to the App Store) is called ad-hoc distribution and is a great way to submit a preview of the app to a client. This form of distribution is covered in detail in Appendix C.

      Enterprise

      The Enterprise iOS Developer Program costs $299 a year and is for large companies that want to develop apps for internal use and will not distribute these apps through the App Store. With the Enterprise iOS Developer Program there is no restriction to the number of devices on which your in-house application can be installed.

To start the registration process, visit the iOS Dev Center (see Figure 1.1) at https://developer.apple.com/programs/enroll/.

Figure 1.1

      The Official iOS SDK

      The Apple iOS SDK (Software Development Kit) is a collection of tools and documentation that you can use to develop iOS apps. The main tools that make up the SDK are:

      • Xcode: Apple's integrated development environment (IDE) that enables you to manage your products, type your code, trace and fix bugs (debugging), and lots more.

      • Interface Builder: A tool fully integrated into the Xcode IDE that enables you to build your application's user interface visually.

      • iOS Simulator: A software simulator to simulate the functions of an iPhone or an iPad on your Mac.

      • Instruments: A tool that will help you find memory leaks and optimize the performance of your apps. Instruments are not covered in this book.

      In addition to these tools, the iOS SDK also includes extensive documentation, sample code, How-To's, and access to the Apple Developer Forums.

      The iOS SDK is available as a free download to registered members (registration is free). However, there are benefits to paid membership, including the ability to debug your code on an iOS device, distribution of your applications, and two technical support incidents a year where Apple engineers will provide you code-level