App Life Cycle

marisol๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ปยท2022๋…„ 8์›” 22์ผ
0
post-custom-banner

๐Ÿ“ App์˜ Unattached, Foreground Inactive, Foreground Active, Background, Suspended์— ๋Œ€ํ•ด ์„ค๋ช…ํ•˜์‹œ์˜ค

  • ํ‚ค์›Œ๋“œ : Unattached, Foreground Inactive, Foreground Active, Background, Suspended

App Life Cycle์€ ์•ฑ์˜ ์‚ฌ์šฉ ๊ณผ์ • ์ค‘ ์•ฑ์ด ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋Š” ์ƒํƒœ๋ฅผ ๋งํ•˜๋ฉฐ,
App-Based Life Cycle์ธ iOS 13 ์ด์ „์—๋Š” Not running, Inactive, Active, Background, Suspended ๋“ฑ์˜ ์ƒํƒœ๊ฐ’์ด ์žˆ๊ณ 
Scene-Based Life Cycle์ธ iOS 13 ์ดํ›„๋ถ€ํ„ฐ๋Š” Unattached, Foreground Inactive, Foreground Active, Background, Suspended ์ƒํƒœ๊ฐ’์ด ์žˆ์Šต๋‹ˆ๋‹ค.

Unattached ์ƒํƒœ๋Š” scene์ด ์—ฐ๊ฒฐ๋˜์ง€ ์•Š์€ ์ƒํƒœ์ด๋ฉฐ
Foreground Inactive๋Š” scene์ด foreground์—์„œ ์‹คํ–‰ ์ค‘์ด์ง€๋งŒ, ์•„๋ฌด๋Ÿฐ ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›๊ณ  ์žˆ์ง€ ์•Š์€ ์ƒํƒœ์ž…๋‹ˆ๋‹ค.
Foreground Active๋Š” scene์ด foreground์—์„œ ์‹คํ–‰ ์ค‘์ด๊ณ , ํ˜„์žฌ ์ด๋ฒคํŠธ๋“ค์„ ๋ฐ›๊ณ  ์žˆ๋Š” ์ƒํƒœ์ž…๋‹ˆ๋‹ค.
Background๋Š” scene์ด ํ™ˆํ™”๋ฉด์ด๋‚˜ ๋‹ค๋ฅธ ์•ฑ์œผ๋กœ ์ „ํ™˜๋œ ์ƒํƒœ์ด๋ฉฐ, ํ™”๋ฉด์—๋Š” ๋ณด์ด์ง€ ์•Š์ง€๋งŒ ์‹คํ–‰๋˜๋Š” ์ฝ”๋“œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฎค์ง ์•ฑ๊ณผ ๊ฐ™์ด ์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ ์•ฑ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์•„๋„ ์‹คํ–‰๋˜์–ด์•ผ ํ•˜๋Š” ์ž‘์—…์ด ์žˆ๋‹ค๋ฉด ์ด ๊ณผ์ •์—์„œ ์ง„ํ–‰ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
Suspended๋Š” scene์ด background ์ƒํƒœ์—์„œ ์•„๋ฌด๋Ÿฐ ์ž‘์—…๋„ ํ•˜์ง€ ์•Š๊ณ  ์žˆ์„ ๋•Œ ์ง„์ž…ํ•˜๋Š” ์ƒํƒœ์ž…๋‹ˆ๋‹ค. ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ๋ถ€์กฑํ•œ ์ƒํ™ฉ์ด ์˜ค๋ฉด ์‹œ์Šคํ…œ์€ foreground์— ์žˆ๋Š” ์•ฑ์˜ ์—ฌ์œ  ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„ ํ™•๋ณด๋ฅผ ์œ„ํ•ด ์ด ์ƒํƒœ์— ์žˆ๋Š” ์•ฑ๋“ค์„ ์ •๋ฆฌํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“Œ ๊ผฌ๋ฆฌ์งˆ๋ฌธ

Foreground Inactive์ƒํƒœ๊ฐ€ ๋˜๋Š” ๊ฒฝ์šฐ๋Š” ์–ด๋–ค ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‚˜์š”?

์–ดํ”Œ์ด ์‹คํ–‰๋˜๊ณ  Foreground Active์ƒํƒœ๋กœ ์ง„์ž…ํ•˜๊ธฐ ์ „, ๋ฉ€ํ‹ฐํƒœ์Šคํ‚น ์œˆ๋„์šฐ๋กœ ์ง„์ž…, ์•Œ๋ฆผ ๋“ฑ์œผ๋กœ ์•ฑ์ด ๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ์ง„์ž…ํ•˜๊ธฐ ์ „๊ณผ ๊ฐ™์ด ๋‹ค๋ฅธ ์ƒํƒœ๋กœ ์ง„์ž…ํ•˜๊ธฐ ์ „์— Foreground Inactive์ƒํƒœ๋ฅผ ๊ฑฐ์ณ์„œ ์ง„์ž…ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

๊ทธ๋Ÿผ iOS 13 ์ด์ „๊ณผ๋Š” App Life Cycle์ด ์–ด๋–ป๊ฒŒ ๋‹ค๋ฅธ๊ฐ€์š”?

  • ํ‚ค์›Œ๋“œ : App-Based Life Cycle, Scene-Based Life Cycle

iOS 12๊นŒ์ง€๋Š” ํ•˜๋‚˜์˜ ์•ฑ์ด ๋Œ€๋ถ€๋ถ„ ํ•˜๋‚˜์˜ window๋ฅผ ๊ฐ€์กŒ์ง€๋งŒ, iOS 13๋ถ€ํ„ฐ๋Š” window์˜ ๊ฐœ๋…์ด scene์œผ๋กœ ๋Œ€์ฒด๋˜๊ณ , ํ•˜๋‚˜์˜ ์•ฑ์—์„œ ์—ฌ๋Ÿฌ ๊ฐœ์˜ scene์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์•ฑ์˜ ์ƒํƒœ๊ฐ€ ๋ณ€๊ฒฝ๋˜๋ฉด, UIKit์€ ์ ์ ˆํ•œ delegate ๊ฐ์ฒด์˜ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์œ ์ €์—๊ฒŒ ์•Œ๋ฆฌ๋Š”๋ฐ์š”,
iOS 12์ด์ „ ๋ฒ„์ „์—์„œ๋Š” scene์„ ์ง€์›ํ•˜์ง€ ์•Š์•˜๊ธฐ ๋•Œ๋ฌธ์— UIApplicationDelegate ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ƒ๋ช… ์ฃผ๊ธฐ ์ด๋ฒคํŠธ์— ์‘๋‹ตํ•˜๊ณ ,
iOS 13 ์ด์ƒ์—์„œ๋Š” UISceneDelegate ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Scene ๊ธฐ๋ฐ˜ ์•ฑ์˜ ์ƒ๋ช… ์ฃผ๊ธฐ ์ด๋ฒคํŠธ์— ์‘๋‹ตํ•ฉ๋‹ˆ๋‹ค.

Scene์— ๋Œ€ํ•ด ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”

  • ํ‚ค์›Œ๋“œ: ๋ฉ€ํ‹ฐ ์œˆ๋„์šฐ

Scene์€ ์•ฑ์˜ UI์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ๊ฐ์ฒด์ž…๋‹ˆ๋‹ค. UIKit์€ ์œ ์ €๋‚˜ ์•ฑ์ด ์š”์ฒญํ•˜๋Š” ์•ฑ UI์˜ ์ธ์Šคํ„ด์Šค๋งˆ๋‹ค scene ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

Scene์€ ๋ฉ€ํ‹ฐ ์œˆ๋„์šฐ๋ฅผ ์ง€์›ํ•˜๊ธฐ ์œ„ํ•ด iOS 13๋ถ€ํ„ฐ ๋„์ž…๋œ ๊ฐœ๋…์ž…๋‹ˆ๋‹ค.
Scene์€ ํ•˜๋‚˜์˜ UI ์ธ์Šคํ„ด์Šค๋ฅผ ํ‘œํ˜„ํ•˜๊ธฐ ์œ„ํ•œ windows์™€ view controllers ๋ฅผ ํฌํ•จํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
Scene๋“ค์€ ๊ฐ™์€ ๋ฉ”๋ชจ๋ฆฌ์™€ ์•ฑ ํ”„๋กœ์„ธ์Šค ๊ณต๊ฐ„์„ ๊ณต์œ ํ•˜๋ฉฐ ๋™์‹œ์— ์‹คํ–‰๋˜๊ธฐ ๋•Œ๋ฌธ์—
ํ•˜๋‚˜์˜ ์•ฑ์—์„œ ์—ฌ๋Ÿฌ ๊ฐœ์˜ scene์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๊ณ , scene delegate ๊ฐ์ฒด๋“ค์€ ๋™์‹œ์— ์ž‘๋™ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฉ€ํ‹ฐ ์œˆ๋„์šฐ๊ฐ€ ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.


์ฐธ๊ณ  ์ž๋ฃŒ

post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€