๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Notification2

[iOS] ํ‘ธ์‹œ์•Œ๋ฆผ ๋ฐ›์•„์„œ ์ฒ˜๋ฆฌํ•˜๊ธฐ ํ‘ธ์‹œ์•Œ๋ฆผ์„ ํ†ตํ•ด ์•ฑ์— ๋“ค์–ด์˜ค๋Š” ๊ฒฝ์šฐ๋Š” ํฌ๊ฒŒ ๋‘๊ฐ€์ง€๋กœ ๋‚˜๋‰  ์ˆ˜ ์žˆ์Šด๋‹ˆ๋‹ค ์•ฑ์ด ์™„์ „ํžˆ ์ข…๋ฃŒ๋œ ์ƒํƒœ inactive/active/background ์ƒํƒœ 1๏ธโƒฃ ์•ฑ์ด ์™„์ „ํžˆ ์ข…๋ฃŒ๋œ ์ƒํƒœ์—์„œ ํ‘ธ์‹œ์•Œ๋ฆผ์„ ํ†ตํ•ด ์•ฑ์— ๋“ค์–ด์˜ค๋Š” ๊ฒฝ์šฐ SceneDelegate์˜ willConnectTo์—์„œ ์ฒ˜๋ฆฌ class SceneDelegate: UIResponder, UIWindowSceneDelegate { ... func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { ... // ์•ฑ ์ข…๋ฃŒ ์ƒํƒœ์—์„œ ํ‘ธ์‹œ์•Œ๋ฆผ์„ ํ†ตํ•ด ์•ฑ์— ์ ‘์†ํ•˜๋Š” ๊ฒฝ์šฐ if let notificatio.. 2022. 10. 12.
[iOS] Notification Center ๐Ÿ“ก Notification Center์ด๋ž€? ํŠน์ • ์ด๋ฒคํŠธ ๋ฐœ์ƒ์‹œ, ํ•ด๋‹น ์ด๋ฒคํŠธ์˜ ๋ฐœ์ƒ ์—ฌ๋ถ€๋ฅผ observe ํ•˜๊ฒ ๋‹ค๊ณ  ๋“ฑ๋กํ•œ ๋ชจ๋“  observer์—๊ฒŒ ์ „๋‹ฌํ•ด์ฃผ๋Š” ๊ฐ์ฒด ์–ธ์ œ ์‚ฌ์šฉํ•˜๋ฉด ์ข‹์„๊นŒโ“ ์ผ๋Œ€๋‹ค ๋˜๋Š” ๋‹ค๋Œ€๋‹ค ํ†ต์‹ ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์•ฑ ๋‚ด์—์„œ ๋ช…์‹œ์ ์œผ๋กœ ์—ฐ๊ฒฐ๋˜์ง€ ์•Š์€ ์ปดํฌ๋„ŒํŠธ ๊ฐ„์˜ ์ƒํ˜ธ์ž‘์šฉ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ํผ์ด๋ผ๋Š” ์ด๋ฆ„์˜ notification์„ ๊ด€์ฐฐํ•˜๊ณ  ์žˆ๋Š” FirstVC์—๊ฒŒ ํ•ด๋‹น noti๊ฐ€ ์ „๋‹ฌ๋ฉ๋‹ˆ๋‹ค! SecondVC์—์„œ dismiss completion์— ํ•ด๋‹น ํผ์ด๋ผ๋Š” ์ด๋ฆ„์˜ notification ์„ post ํ•ด์ฃผ๋ฉด FirstVC์—์„œ ํผ์ด๋ผ๋Š” ์ด๋ฆ„์˜ notification ์„ ๊ด€์ฐฐํ•˜๊ฒ ๋‹ค๊ณ  addObserve ํ•˜๊ณ  ex) ํ™”๋ฉด ์ „ํ™˜ ํ›„ pop ๋˜๋Š” dismissํ•  ๋•Œ ๋Œ์•„์˜จ VC์— ์†ํ•œ ๋ฌด์–ธ๊ฐ€๋ฅผ ์‹คํ–‰ํ•ด์•ผ ํ•˜๋Š”.. 2022. 3. 14.