14
1/29/20 1 1 - CSE 439 – Mobile Application Development II Announcement On Monday your February plan is due Please submit your plan to your Github Classroom Repo by 11:59 PM on Monday evening Details regarding the February plan are on the course website 1 2 - CSE 439 – Mobile Application Development II Today – Frontend/Backend Techniques Xcode Debugger AutoLayout Review SwiftUI App States More about backend and Firebase 2

cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

1

Extensible Networking Platform 11 - CSE 439 – Mobile Application Development II

Announcement

• On Monday your February plan is due

• Please submit your plan to your Github Classroom

Repo by 11:59 PM on Monday evening

• Details regarding the February plan are on the

course website

1

Extensible Networking Platform 22 - CSE 439 – Mobile Application Development II

Today – Frontend/Backend Techniques

• Xcode Debugger

• AutoLayout Review

• SwiftUI

• App States

• More about backend and Firebase

2

Page 2: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

2

Extensible Networking Platform 33 - CSE 439 – Mobile Application Development II

Let’s admit it...

Source: https://me.me/i/debug-properly-using-a-debugger-println-5f3a117e2b0d4228b775268ead9c0851

3

Extensible Networking Platform 44 - CSE 439 – Mobile Application Development II

Back to reality...debuggers are pretty awesome

• ...and it’s probably something you have to learn at some point

• Xcode uses LLDB debugger as its default debugging tools.

• According to its homepage:

• “LLDB is a next generation, high-performance debugger. It is built as

a set of reusable components which highly leverage existing libraries

in the larger LLVM Project, such as the Clang expression parser and

LLVM disassembler”.

4

Page 3: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

3

Extensible Networking Platform 55 - CSE 439 – Mobile Application Development II

Debugging teaser demo

5

Extensible Networking Platform 66 - CSE 439 – Mobile Application Development II

Debugging Tutorial by Apple

6

Page 4: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

4

Extensible Networking Platform 77 - CSE 439 – Mobile Application Development II

SwiftUI

7

Extensible Networking Platform 88 - CSE 439 – Mobile Application Development II

Swift UI

• Introduced in WWDC 19. A radically new and powerful way to code UI

• No storyboard anymore. All UI is codified using Swift

• Feels a little bit like React?

• We don’t require you to use this as it’s relatively new, but you are more

than welcome to try it.

8

Page 5: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

5

Extensible Networking Platform 99 - CSE 439 – Mobile Application Development II

Resources to learn more about Swift UI

There is a series of SwiftUI tutorials by Apple available here that covers it very well:

Apple’s SwiftUI Tutorials

WWDC 19 Intro to SwiftUI

9

Extensible Networking Platform 1010 - CSE 439 – Mobile Application Development II

SwiftUI teaser demo

10

Page 6: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

6

Extensible Networking Platform 1111 - CSE 439 – Mobile Application Development II

App Life-Cycle

In iOS 13 and apps that support scenes:

Scene-Based Life-Cycle Events

Before iOS 13 or for apps that don’t support scenes:

App-Based Life-Cycle Events

11

Extensible Networking Platform 1212 - CSE 439 – Mobile Application Development II

App-Based Life Cycle Events

For more information, check out Apple’s Managing Your App's Life Cycle

12

Page 7: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

7

Extensible Networking Platform 1313 - CSE 439 – Mobile Application Development II

From Not-running to Inactive: App Launch Sequence

From Apple’s About the App Launch Sequence

13

Extensible Networking Platform 1414 - CSE 439 – Mobile Application Development II

From Not-running to Inactive

application(_:willFinishLaunchingWithOptions:)application(_:didFinishLaunchingWithOptions:)

For more information, check out Apple’s Responding to the Launch of Your App

14

Page 8: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

8

Extensible Networking Platform 1515 - CSE 439 – Mobile Application Development II

Inactive And Active

For more information, check out Apple’s Preparing Your UI to Run in the Foreground

applicationDidBecomeActive(_:)viewWillAppear(_:)

applicationWillResignActive(_:)

15

Extensible Networking Platform 1616 - CSE 439 – Mobile Application Development II

Inactive And Background

applicationDidEnterBackground(_:)

applicationWillEnterForeground(_:)

For more information, check out Apple’s Preparing Your UI to Run in the Foreground and Preparing Your UI to Run in the Background

16

Page 9: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

9

Extensible Networking Platform 1717 - CSE 439 – Mobile Application Development II

UIScene

• Introduced in WWDC 19 as

another feature in iOS 13

• Features better support for

multiwindow

• Using UIScene, one app can have

two running instances at the

same time, like the one on the

left.For more information, check out WWDC 19 video Architecting Your App for Multiple Windows

17

Extensible Networking Platform 1818 - CSE 439 – Mobile Application Development II

Relationship between App Delegate and Scene Delegate

For more information, check out WWDC 19 video Architecting Your App for Multiple Windows

18

Page 10: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

10

Extensible Networking Platform 1919 - CSE 439 – Mobile Application Development II

Scene-Based Life Cycle Events

For more information, check out Apple’s Managing Your App's Life Cycle

19

Extensible Networking Platform 2020 - CSE 439 – Mobile Application Development II

Inactive And Active (Scene)

For more information, check out Apple’s Preparing Your UI to Run in the Foreground

sceneDidBecomeActive(_:)

sceneWillResignActive(_:)

20

Page 11: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

11

Extensible Networking Platform 2121 - CSE 439 – Mobile Application Development II

Inactive And Background (Scene)

sceneDidEnterBackground(_:)

sceneWillEnterForeground(_:)

For more information, check out Apple’s Preparing Your UI to Run in the Foreground and Preparing Your UI to Run in the Background

21

Extensible Networking Platform 2222 - CSE 439 – Mobile Application Development II

Backend

22

Page 12: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

12

Extensible Networking Platform 2323 - CSE 439 – Mobile Application Development II

General Backend Notes• Even for mobile apps, it’s usually not sufficient to just have a database as your

backend.

• Sometimes you want to perform more complicated or intensive tasks than what

your database can handle.

• And you want to keep the frontend as lightweight as possible for better user

experience.

23

Extensible Networking Platform 2424 - CSE 439 – Mobile Application Development II

Firebase cloud functions

• Powerful, lightweight backend functions

• Easy to implement and test; each function is usually a short snippet of

code.

• Integrates well with cloud messaging and other Firebase services.

• Available in both JavaScript and TypeScript.

• Firebase official docs: https://firebase.google.com/docs/functions

24

Page 13: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

13

Extensible Networking Platform 2525 - CSE 439 – Mobile Application Development II

Cloud function demo

25

Extensible Networking Platform 2626 - CSE 439 – Mobile Application Development II

Firebase ML Kit

• Backend machine learning functions provided by Firebase

• Comes with a set of pre-trained model.

• Easy to use. Using each of them is like calling an API.

• Can also handle your own Tensorflow model.

• Docs: https://firebase.google.com/docs/ml-kit

26

Page 14: cse439 lecture4 1-29-20todd/cse439/cse...2020/01/29  · Architecting Your App for Multiple Windows 18 1/29/20 10 19Extensible Networking Platform-CSE 439 –Mobile Application Development

1/29/20

14

Extensible Networking Platform 2727 - CSE 439 – Mobile Application Development II

Other notes about backend• We think a combination of database, cloud functions and machine

learning kit can satisfy many needs for backend in the case of a mobile app.

• But if your app requires more backend support, you can develop fully fledged web apps to achieve that.

• Firebase is integrated into Google Cloud, so if you want to stay within it, Google App Engine is a great choice.

• For those of you who had 330, AWS is also a very popular platform.

27