49
Simon Völker & Philipp Wacker Media Computing Group RWTH Aachen University hci.rwth-aachen.de/ios Lecture 2: Seminar Topics and Unit 1 iOS Application Development

iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Simon Völker & Philipp Wacker Media Computing Group RWTH Aachen University

hci.rwth-aachen.de/ios

Lecture 2: Seminar Topics and Unit 1

iOS Application Development

Page 2: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Seminar• 2 Presentations per Session

• 20 min presentation, ~10 min discussion

• 3 people per group

• Dates:

• 18.11, 19.11, 25.11, 26.11, 2.12, 3.12, 9.12

• Order is not fixed yet!

2 Simon Voelker, Philipp Wacker: iOS Application Development

• Finished version 1 week before the presentation

• 15 min slide and content discussions1 week before the presentation

Page 3: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Seminar• Framework overview

• Conceptional structure

• Show how to use them

3 Simon Voelker, Philipp Wacker: iOS Application Development

• Structure:

• Brief introduction

• Basis steps how to use the framework

• Demo (live coding)

• Explain one or two advanced features and show how to use them.

• Deliverables: Slides and Demo code

Page 4: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Topic: Sprite Kit• 2D Gaming Engine

• Visuals are Sprites, Shapes

• Includes:

• Animations

• Physics

• Lighting

• Particle effects

Simon Voelker, Philipp Wacker: iOS Application Development4

We will show a very short demo presentation

Page 5: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

1. Core Data• Manages the model in MVC

• Persistant data storage

• Managed objects

• Alternative to SQL

Simon Voelker, Philipp Wacker: iOS Application Development5

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreData/index.html

https://developer.apple.com/videos/play/wwdc2017/210/

https://developer.apple.com/videos/play/wwdc2019/230/

Page 6: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

• High-level 3D game engine

• Scene graphs

• Animations

• Physics

2. Scene Kit

Simon Voelker, Philipp Wacker: iOS Application Development6

https://developer.apple.com/scenekit/

https://developer.apple.com/videos/play/wwdc2017/605/

https://developer.apple.com/videos/play/wwdc2017/604/

Page 7: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

3. Metal• Low level renderer

• Modern alternative to OpenGL

• Precompiled shaders

• Multithreading

• Speed increase by reducing CPU load

Simon Voelker, Philipp Wacker: iOS Application Development7

https://developer.apple.com/metal/

https://developer.apple.com/videos/play/wwdc2019/601/

https://developer.apple.com/videos/play/wwdc2019/613/

Page 8: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

4. CloudKit & iCloud Drive• Cloud storage

• Cross devices files sharing

• Storage optimization

Simon Voelker, Philipp Wacker: iOS Application Development8

https://developer.apple.com/icloud/

https://developer.apple.com/videos/play/wwdc2017/226/

Page 9: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

5. Core ML + Create ML• Machine learning

• Computer vision (Vision Framework)

• Natural language processing

Simon Voelker, Philipp Wacker: iOS Application Development9

https://developer.apple.com/machine-learning/

https://developer.apple.com/videos/play/wwdc2019/209/

https://developer.apple.com/videos/play/wwdc2019/704/

https://developer.apple.com/videos/play/wwdc2019/430/

https://developer.apple.com/videos/play/wwdc2018/708/

https://developer.apple.com/videos/play/wwdc2018/709/

Page 10: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

6. SiriKit• Add Siri to your app

• Voice commands

Simon Voelker, Philipp Wacker: iOS Application Development10

https://developer.apple.com/sirikit/

https://developer.apple.com/videos/play/wwdc2017/214/

Page 11: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

7. WatchOS• Design apps for the Apple Watch

• Native WatchOS apps

Simon Voelker, Philipp Wacker: iOS Application Development11

https://developer.apple.com/videos/play/wwdc2019/208/

https://developer.apple.com/videos/play/wwdc2018/239/

https://developer.apple.com/videos/play/wwdc2018/206/

Page 12: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

8. MapKit, CoreLocation• Map navigation

• Location detection

• Geofencing

Simon Voelker, Philipp Wacker: iOS Application Development12

https://developer.apple.com/maps/

https://developer.apple.com/videos/play/wwdc2019/705/

https://developer.apple.com/videos/play/wwdc2017/713/

https://developer.apple.com/videos/play/wwdc2019/236/

Page 13: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

9. Networking on iOS• CoreBluetooth

• Sockets

• Bonjour

Simon Voelker, Philipp Wacker: iOS Application Development13

https://developer.apple.com/videos/play/wwdc2019/901/

https://developer.apple.com/videos/play/wwdc2019/713/

https://developer.apple.com/videos/play/wwdc2019/712/

https://developer.apple.com/videos/play/wwdc2017/712/

https://developer.apple.com/videos/play/wwdc2017/707/

https://developer.apple.com/videos/play/wwdc2017/709/

Page 14: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

10. Extensions & Inter-App communication• Deep Linking

• App Extensions (Services)

• Files app

Simon Voelker, Philipp Wacker: iOS Application Development14

https://developer.apple.com/app-extensions/

https://developer.apple.com/videos/play/wwdc2017/250/

Page 15: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

11. Debugging in Xcode and Instruments• Instruments

• Energie consumptions

Simon Voelker, Philipp Wacker: iOS Application Development15

https://developer.apple.com/videos/play/wwdc2019/411/

https://developer.apple.com/videos/play/wwdc2019/412/

https://developer.apple.com/videos/play/wwdc2018/412/

https://developer.apple.com/videos/play/wwdc2018/410/

https://developer.apple.com/videos/play/wwdc2018/416/

Page 16: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

12. ClassKit• Create class exercises

• Schoolwork apps

• Student and teach classroom curriculum support

Simon Voelker, Philipp Wacker: iOS Application Development16

https://developer.apple.com/videos/play/wwdc2019/247/

https://developer.apple.com/videos/play/wwdc2018/215/

Page 17: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

13. RealityKit & Reality Composer• Simulate and render 3D content in AR

• Prototype AR scenes and apps

Simon Voelker, Philipp Wacker: iOS Application Development17

https://developer.apple.com/videos/play/wwdc2019/603/

https://developer.apple.com/videos/play/wwdc2019/605/

https://developer.apple.com/videos/play/wwdc2019/609/

https://developer.apple.com/videos/play/wwdc2019/415/

Page 18: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

14. Bringing People into AR • Detect people and object in a AR scene

• Body tracking

Simon Voelker, Philipp Wacker: iOS Application Development18

https://developer.apple.com/videos/play/wwdc2019/610/

https://developer.apple.com/videos/play/wwdc2019/607/

Page 19: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

15. GameplayKit• Gameplay logics

• Agents

• Pathfinding

• Rule systems

Simon Voelker, Philipp Wacker: iOS Application Development19

https://developer.apple.com/documentation/gameplaykit

https://developer.apple.com/videos/play/wwdc2016/608/

https://developer.apple.com/library/archive/documentation/General/Conceptual/GameplayKit_Guide/index.html

Page 20: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

16. SwiftUI• Design Apps using simple SwiftUI framework

• Declarative syntax

• Design tools

Simon Voelker, Philipp Wacker: iOS Application Development20

https://developer.apple.com/videos/play/wwdc2019/216/

https://developer.apple.com/videos/play/wwdc2019/204/

https://developer.apple.com/videos/play/wwdc2019/231/

https://developer.apple.com/videos/play/wwdc2019/231/

https://developer.apple.com/videos/play/wwdc2019/226/

https://developer.apple.com/videos/play/wwdc2019/237/

Page 21: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

17. AVKit• Low-Latency HLS

• Media playback

• Multi-Camera capture for iOS

Simon Voelker, Philipp Wacker: iOS Application Development21

https://developer.apple.com/videos/play/wwdc2019/249/

https://developer.apple.com/videos/play/wwdc2019/502/

https://developer.apple.com/videos/play/wwdc2019/503/

Page 22: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Forming Groups & Vote for the Topic

Simon Voelker, Philipp Wacker: iOS Application Development22

Topic1. Core Data2. Scene Kit3. Metal4. CloudKit & iCloud Drive5. Core ML + Create ML6. SiriKit7. WatchOS8. MapKit, CoreLocation9. Networking on iOS10. Extensions & Inter-App communication11. Debugging in Xcode and Instruments12. ClassKit13. RealityKit & Reality Composer14. Bringing People into AR 15. GameplayKit16. Swift UI17. AVKit

Give each topic a different rating.

Please rate your interest in each topic on a scale from 1 (highly interested) to 17 (not interested at all).

Page 23: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Simon Voelker, Philipp Wacker: iOS Application Development23

CHAPTER 1

Swift

Page 24: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

History• Introduced at WWDC 2014

• Influenced by C and Objective-C

• But designed to be simpler to learn and not dependent on older programming languages

• “Safe, fast, and expressive”

• Open source since 2015

Simon Voelker, Philipp Wacker: iOS Application Development24

Page 25: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Characteristics• Clean syntax

• Optionals

• Type inference

• Type safety

• Automatic Reference Counting (ARC)

Simon Voelker, Philipp Wacker: iOS Application Development25

Page 26: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Characteristics• Tuples and multiple return values

• Generics

• Fast and concise iteration over collections

• Structs that support methods, extensions, and protocols

• Map, filter, reduce, and other functional programming patterns

• Powerful error handling

Simon Voelker, Philipp Wacker: iOS Application Development26

Page 27: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Playgrounds

Simon Voelker, Philipp Wacker: iOS Application Development27

Page 28: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Variables and Constants• Variables are declared with var

• Constants are declared with let

Simon Voelker, Philipp Wacker: iOS Application Development28

var x = 100

let pi = 3.14 pi = 3.1415926 // error! a constant can’t be changed afterwards

Page 29: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Simon Voelker, Philipp Wacker: iOS Application Development29

Page 30: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Type Inference • Swift automatically chooses the adequate data type for a variable/constant

• You can also explicitly specify the type

Simon Voelker, Philipp Wacker: iOS Application Development30

var x = 100 x = 99.5 // error! x is of type Integer

var x = 99.5 x = 100 // correct (x = 100.0, type: Double)

var aString : String

Page 31: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Data Types & Type Inference

Simon Voelker, Philipp Wacker: iOS Application Development31

var x1 = 100 // Int

var x2 = 0.5 // Double

var x3 = x1 + x2 // error! can’t add Int and Double var x3 = Double(x1) + x2 // works! explicit type casting to Double

var x4 = 0.5 + 100 // works! compiler adds before setting the data type

print("x4 = \(x4)") // x4 = 100.5

var 😂 = "LOL" // String

Page 32: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Optionals• By default, variables and constants cannot be nil

• Optionals: variables that can also be nil

• Normal variables and Optionals are incompatible to each other

Simon Voelker, Philipp Wacker: iOS Application Development32

var opt:Int? = 3

opt = nil

var number = Int("abc") // nil. Type of Number: Int?

print(number + 3) // error! Int? != Int

var i:Int = number // error!

Page 33: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Tuples• Tuples can have multiple elements of different types

Simon Voelker, Philipp Wacker: iOS Application Development33

var tuple = (1, 2.0, “hello”, true) var (a,b,c,d) = tuple // a = 1, …

print(tuple.2) // “hello” (starts at 0)

Page 34: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Simon Voelker, Philipp Wacker: iOS Application Development34

Page 35: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Control Flow

Simon Voelker, Philipp Wacker: iOS Application Development35

• If/else • Ternary Operator

var x=3

if x<0 { print("x is negative") } else if x==0 { print ("x is zero”) } else { print("x is positive") }

var largest: Intlet a = 15let b = 4

if a > b { largest = a}else { largest = b}

largest = a > b ? a : b

Page 36: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Control Flow

Simon Voelker, Philipp Wacker: iOS Application Development36

• Switch

let pt = (0.0, 0.0)

switch pt {case (0,0): print("Origin.")case (_,0): print ("On x-axis.")case (0,_): print ("On y-axis.")default: print ("Elsewhere.") }

switch distance { case 0...9: print("You are close”) case 10...500: print("Take a car") default: print("Too far away.") }

Page 37: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Simon Voelker, Philipp Wacker: iOS Application Development37

CHAPTER 4

Development Environment

Page 38: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Xcode

Simon Voelker, Philipp Wacker: iOS Application Development38

Page 39: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Playground Demo

Simon Voelker, Philipp Wacker: iOS Application Development39

Page 40: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Xcode• 5 areas

1. Editor

2. Toolbar

3. Navigator

4. Debugging

5. Utility

Simon Voelker, Philipp Wacker: iOS Application Development40

1

2

3

4

5

Page 41: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

.xcodeproj File• Settings file for your project

Simon Voelker, Philipp Wacker: iOS Application Development41

Page 42: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Building/Running

Simon Voelker, Philipp Wacker: iOS Application Development42

Page 43: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Warnings & Errors• Warnings don’t prevent your app from compiling & running

• Code that never gets executed

• Variable that does not change

• Deprecated code

• Errors prevents the app from building

• Invalid code (typo, variable declaration, function calling)

• Xcode often provides suggestions & fixes

Simon Voelker, Philipp Wacker: iOS Application Development43

Page 44: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

• Set breakpoints for execution on simulator and device

• Continue, Step over, Step into, Step out

Debugging

Simon Voelker, Philipp Wacker: iOS Application Development44

Page 45: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Documentation• Quick Help (Option+Click)

• Documentation Browser

• Programming Guides

Simon Voelker, Philipp Wacker: iOS Application Development45

Page 46: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Interface Builder• Visually define your UI

Simon Voelker, Philipp Wacker: iOS Application Development46

Page 47: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Outlets & Actions• Connect your UI elements with your code: Right-click + Drag

Simon Voelker, Philipp Wacker: iOS Application Development47

Page 48: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Outlets & Actions• IBOutlet

• Access the UI element from code

• IBAction

• Receive UI events

Simon Voelker, Philipp Wacker: iOS Application Development48

@IBOutlet weak var textLabel: UILabel!

@IBAction func buttonPressed(_ sender: Any) {}

Page 49: iOS Application Development - RWTH Aachen University · 2019-10-11 · Simon Voelker, Philipp Wacker: iOS Application Development. Topic 1. Core Data 2. Scene Kit 3. Metal 4. CloudKit

Summary• Basic concept of Swift

• Data Types, Control Flow, Tuples

• Development Environment

• Xcode

• Playgrounds

• Tomorrow: Unit 2: Strings, Classes and Structs…

Simon Voelker, Philipp Wacker: iOS Application Development49