Xcode and Swift CS 4720 Mobile Application Development CS 4720 - - PowerPoint PPT Presentation

xcode and swift
SMART_READER_LITE
LIVE PREVIEW

Xcode and Swift CS 4720 Mobile Application Development CS 4720 - - PowerPoint PPT Presentation

Xcode and Swift CS 4720 Mobile Application Development CS 4720 Why Java for Android? Lets first recap: why do you think Android uses Java? CS 4720 2 Why Java for Android? Some good reasons: You cant find a CS major


slide-1
SLIDE 1

CS 4720

Xcode and Swift

CS 4720 – Mobile Application Development

slide-2
SLIDE 2

CS 4720

Why Java for Android?

  • Let’s first recap: why do you think Android uses

Java?

2

slide-3
SLIDE 3

CS 4720

Why Java for Android?

  • Some good reasons:

– You can’t find a CS major that doesn’t know Java – Java’s relatively easy to pick up – Code runs in a VM, which means you don’t have to recompile for every different phone platform – Tons of tools and support – Java manages pointers and garbage collection automatically, so less likely to get in trouble – Java ME already a thing for mobile

3

slide-4
SLIDE 4

CS 4720

History of Apple Development

  • To appreciate where iOS development came

from, we need to look back at how developing for Apple platforms became what it is

  • And that story begins with Smalltalk

4

slide-5
SLIDE 5

CS 4720

Smalltalk

  • Created in the 1970s at Xerox PARC
  • Originally built for educational purposes
  • Smalltalk is basically THE ancestor for object-
  • riented development
  • Many of the OO patterns we know (like MVC)

started with Smalltalk

  • Major influence in Agile, GUIs, and IDEs

5

slide-6
SLIDE 6

CS 4720

Smalltalk

  • Yes, at the heart of Smalltalk is objects

(everything is an object)

  • But the real take away is messaging
  • Method calls are effectively messages with

answers

6

slide-7
SLIDE 7

CS 4720

Smalltalk

42 factorial 2 raisedTo: 4 ‘hello world’ indexOf: $o startingAt: 6 Rectangle width: 100 height: 200 3 + 4 3 > 4

7

slide-8
SLIDE 8

CS 4720

Objective-C

  • In the 1980s, work on Objective-C began at a

telecom company, ITT

  • The thought was OO was the future (and

Smalltalk was the blueprint) but backwards compatibility with C legacy systems was important

  • The main description of Objective-C was

published in 1986

8

slide-9
SLIDE 9

CS 4720

Objective-C

  • In 1988, NeXT licensed Objective-C and began

work to extend the GCC compiler

  • NeXT built foundational tools for building good

user interfaces

  • NeXT computers never really took off…
  • … but basically everyone thought the toolsets

were really great

  • So, NeXT started focusing on software

9

slide-10
SLIDE 10

CS 4720

NeXTSTEP

10

slide-11
SLIDE 11

CS 4720

Objective-C

  • Oh, by the way…
  • NeXT was founded by Steve Jobs after he was

forced out of Apple in the late 1980s…

  • NeXT was purchased in full by Apple in 1997
  • Jobs took over as CEO of the combined

company at the same time

  • Jobs canned several smaller projects (like the

Newton)

11

slide-12
SLIDE 12

CS 4720

Objective-C

  • However, one major project had stalled out
  • The creation of the “next generation” Mac OS
  • With the purchase of NeXT…
  • … and the Unix underpinnings of NeXTSTEP…
  • … built using Objective-C…
  • Cocoa and OS X were born!

12

slide-13
SLIDE 13

CS 4720

Cocoa

  • Cocoa is the native OO API for OS X
  • Built using Objective-C
  • Cocoa apps were created using Project Builder

and Interface Builder

– Tools originally created for the NeXTSTEP system

  • Cocoa is important in that it “forces”

applications to adhere to Apple UI guidelines

  • Project Builder + Interface Builder = Xcode

13

slide-14
SLIDE 14

CS 4720

Cocoa Touch

  • With the creation of iOS, came Cocoa Touch
  • Still Objective-C
  • Still MVC
  • Still Unix-based underneath it all
  • So, Objective-C became the default language

for building for iOS

  • Until…

14

slide-15
SLIDE 15

CS 4720

Swift

  • Introduced at WWDC 2014 as “Objective-C

without the C”

  • Meant to address memory and type safety

issues present in Objective-C

  • Switches the message-passing syntax of

Objective-C for the more common dot notation found in Java, etc.

  • Builds in many of the old standard Apple data

types (like NSString)

15

slide-16
SLIDE 16

CS 4720

Swift

  • The language itself looks much more “Java-

like” with many keywords carried over

  • Semicolons not required though
  • In general, shouldn’t take too long for a Java

programmer to pick up

  • Uses Objective-C runtime, so it can import any

Objective-C libraries

  • Swift 2.0 released September 16, 2015
  • Open sourced on December 3, 2015

16

slide-17
SLIDE 17

CS 4720

Where does this leave us?

  • You don’t HAVE to develop iOS apps using

Objective-C or Swift

  • However, that is the way to do native

development (yes, you can KINDA do this with some third party tools…)

  • As of now, to build iOS apps using Objective-C
  • r Swift, you need to use Xcode
  • To use Xcode, you need a Mac…

17

slide-18
SLIDE 18

CS 4720

Developing with Xcode

  • If you don’t own a Mac
  • Mac Minis in Rice 340
  • Unix logins should work
  • Check to see if you can swipe in
  • Another option is

http://www.macincloud.com/

18

slide-19
SLIDE 19

CS 4720

Xcode and Swift

  • Things to cover:

– Simulators vs. Emulators – How to hook up to Github – Using the Interface Builder to connect code to UI

  • bjects

19