iOS Development

iOS Development Languages

Michael L. Collard, Ph.D.

Department of Computer Science, The University of Akron

iOS Development Languages

  • Objective-C
    • Main development language for OS X, iOS and their APIs, Cocoa and Cocoa Touch
  • Swift

Objective-C

History

Timeline

  1. NeXT founded in 1985 by Steve Jobs
  2. Licensed Objective-C from StepStone
  3. NeXTSTEP o.s. developed using it
    • OS X and iOS are derived from NeXTSTEP (NS naming originates from this)
  4. Extended GCC compiler to support it, and develops the OpenStep API
  5. Apple buys NeXT (?) in 1996
  6. Apple uses Objective-C and Project Builder (now called Xcode)
  7. Cocoa API based on OpenStep

Syntax

Support Details

  • Small, runtime system used to resolve message passing (versus VM approach)
  • Dynamic typing and reflection supported
  • Garbage collection not supported
    • Originally: Managed own memory (as in C++)
    • Brief Period of Time: Garbage Collection (deprecated)
    • Recently: ARC (Automated Reference Counting)

Implementation

  • Clang
    • compiler front end
    • open-source project
    • replacement for GCC
  • LLVM
    • compiler infrastructure
  • Chris Lattner
    • Heavily involved with both Clang and LLVM
    • Apple employee

What's wrong with Objective-C?

  • Not a good introductory language
  • C
  • Developer memory management (even with ARC)
  • Pointers
  • Language concepts have changed since Objective-C was created, e.g., dynamic languages

Why not just us a new language?

  • Existing frameworks would all have to be converted
  • Monumental task
  • Many existing dynamic languages have memory and compute time inefficiences

Swift

  • New programming language developed by Chris Lattner
  • First announced at Apple's WWDC (World Wide Developer Conference) June 2, 2014
  • Described as "Objective-C without the C"
  • Also described as faster then Objective-C
  • Still in Beta (i.e., the syntax is still being finalized)

How does Swift solve the new language problem?

  • Swift allows the use of the same frameworks as Objective-C
  • Can be combined with Objective-C code
  • Apple has full control over the implementation (compiler technologies)

Class Practicalities

  • The syntax of Swift is not even frozen yet
  • Many examples, samples, standard programming practices, etc. are only available for Objective-C
  • However, Swift is the future for iOS App development

Performance Issue

Xcode

  • Swift REPL (Read-Eval-Print-Loop)
    • xcrun swift
  • Swift Playgrounds