• No results found

Getting Started with iOS Development Mobile applications are commonly designated as being a

"native" "mobile web" or "hybrid" app. Generally a native iOS

App is built using Apple's platform, whereas a Hybrid app uses a 3rd party platform like Xamarin, Appcelerator and Phone Gap. These platforms try to make developing for multiple mobile platforms possible using one set of tools and language. Mobile Web apps typically use HTML5 standards to create what looks like a native app via a web browser on the device.

Along with the SDK to develop for iOS, Apple also provides an Integrated Development Environment (IDE) called Xcode to create both iOS and OSX applications. As Xcode has evolved, Apple has strived to provide all the needed tools to write, test, monitor performance and deploy apps to the App Store all from inside Xcode.

Xcode

Apple released Xcode in 2003 for writing applications in OS X. Version 3 of Xcode supported the first iPhone SDK in 2008 and the most recent version is Xcode 7, released with iOS 9 in September 2015. Xcode is an integrated development environ- ment used during the whole application development life-cycle. Interface Builder is a visual design tool used to design and wire together views of the application without writing code and is integrated with Xcode. Also provided is an iOS Simulator to allow developers to test their apps on all current devices without having to always install apps on physical devices.

iOS Interface Builder

A lot of discussion in iOS developer circles is whether it is better to use Interface Builder to visually design the UI and application flow or to undertake it all manually with code. In the past this may have been a personal preference but with new devices and screen sizes like the Apple Watch and iPhone 6, the case can be made that Interface Builder is becoming more essential. One of the primary differences between iOS and Android development was not having to develop for several device types and screen sizes. However this line is becoming more blurry with iOS 9 supporting six different screen sizes. Instead of supporting all of them separately in your applica- tions, Interface Builder uses concepts such as Auto-Layout and Adaptive Layout to aid the developer in supporting all screen sizes more easily. With each new version of Xcode, Interface Builder has seen improvement and advancement so it is apparent that Apple prefers developers to take advantage of it. Something a new iOS developer should consider.

Objective C

Objective C has it roots in the NeXTSTEP operating system developed in the 1980s from where OSX and iOS are derived. It is an object-oriented programming language that adds messag- ing to the C Programming language7. In fact C and C++ can be

written alongside Objective C and some of the iOS frameworks only provide a C level API to access. However, it has been criticised for having a quirky syntax with a plethora of aster- isks, '@' signs, and square brackets which leads to a higher learning curve for developers coming from modern languages such as Java or C# while providing improved legibility through named parameters and verbose class and method names. Incre-

iOS

mental improvements have been added over the years includ- ing dot notation of object properties, blocks, collection literals and memory management via Automatic Reference Counting (ARC). But the remaining need to use pointers, header files and remain tightly coupled to the limitations and risks of the C language has left Apple to conclude a new modern language is needed.

Swift

In July 2010 Chris Lattner, Senior Director and Architect in the Developer Tools Department at Apple began implementing the basic language structure of a new programming language whose existence only a few people knew of. It became a major focus for the Apple Developer Tools group in July 2013 and almost a year later at Apple's World Wide Developer Conference (WWDC) Apple announced a new programming language for iOS and OSX called Swift. Lattner stated Swift is influenced by other languages such as C#, Ruby, Haskell, Python and countless others8

Apple felt the reason to create Swift was the need for modern language syntax that is more concise and easier to learn for new iOS developers, including modern features like in- ferred data types, data structure declarations, tuples, closures, optional semicolons and no pointers. It has been suggested Apple's support for Swift is to ensure iOS developers stay interested in Apple's tools and don't look at other platforms with modern language support for iOS development.

iOS

In early December 2015, Apple open-sourced Swift9 along

with a bunch of related tools, frameworks and examples. Apple is actively engaging the community in the future development of the language by soliciting feedback, proposals for new language features and pull requests. Less than a week after it was first open-sourced, Swift is already the #1 open source programming language on GitHub10, overtaking other popular

languages like Ruby or PHP.

Performance Tools and Testing

In addition to providing the tools to develop iOS applications, Xcode also comes with tools for performance monitoring and testing.

Instruments allows developers to collect data about the performance and behaviour of their iOS apps over time. Some of the common templates offered allow developers to track memory leaks, or detect application "hot spots" using the profiler instrument. The Automation instrument is used to au- tomate user interface tests in your iOS app through test scripts written by the developer. These scripts run outside of the app and simulate user interaction by calling the UI Automation API. It can be run on a device or simulator.

XC Test Framework is the test framework integrated with Xcode to provide extensive testing in an organised and efficient way. By default, new projects created in Xcode using one of the application templates will add a Test target to the project. This allows the developer to write their own unit test classes, execute them and analyse the results using the Test Navigator, all from inside Xcode.

9 github.com/apple/swift

iOS Setting Up the Dev Environment

After registering for a free developer account at developer. apple.com access is granted to download Xcode, sample code, videos, and documentation. Requirements to run all Xcode tools is a Mac computer running OS X 10.10 (Yosemite) along with the iOS SDK. This setup will allow for the creation and testing of iOS apps to run in the iOS Simulator. To submit apps to the App Store you must upgrade the developer account at a cost of $99 a year which also gives access to betas of future versions of Xcode and iOS as they are released.

Distribution

The primary method for deploying apps to consumers is through the App Store. Each app submitted is reviewed by the Apple review team to ensure it meets the requirements and standards set by Apple. This is a major difference from the Google Play store for Android apps where Google does not review apps but ensures they are code signed.

Apple is very strict on how 3rd party applications run on iOS and uses the Sandbox technique to ensure application security and tries to prevent nefarious or buggy code that could compromise the OS, other applications or the device. Think of a sandbox as a virtual barrier around the application that sets the rules of what resources the app can access. For example an application does not have access to another app's file directory or system resources not accessed by the SDK frameworks. Apple has given more control to the user to grant access to their data (i.e. contacts, calendars, photos) or GPS location. Developers must prepare for cases where the user has denied these type of requests.

iOS