๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
728x90
๋ฐ˜์‘ํ˜•

๐ŸŽ iOS/WWDC3

[WWDC 2022] Swift๋กœ ํ”„๋กœํ† ์ฝœ ์ธํ„ฐํŽ˜์ด์Šค ์„ค๊ณ„ํ•˜๊ธฐ (Design protocol interface in Swift) ์•ˆ๋…•ํ•˜์„ธ์š” Foma ์ž…๋‹ˆ๋‹ค! ์˜ค๋Š˜์€ ์ €๋ฒˆ ๊ธ€์ธ Embrace Swift Generics์—์„œ ๊ณ„์† ์–ธ๊ธ‰ํ•˜๋˜ Design protocol interface in Swift ์„ธ์…˜์— ๋Œ€ํ•ด์„œ ๋‹ค๋ค„๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค! (์ €๋ฒˆ ๊ธ€๊ณผ ๋งŽ์ด ์—ฐ๊ด€๋˜์–ด ์žˆ์œผ๋‹ˆ ์•ˆ๋ณด์‹  ๋ถ„๋“ค์€ ๊ผญ ์—ฌ๊ธฐ ์—์„œ ๋ณด๊ณ  ์™€์ฃผ์„ธ์š”!) ๋ฐ”๋กœ ์‹œ์ž‘ํ• ๊ฒŒ์š”~ Understand type erasure ๊ฐ€์žฅ ๋จผ์ € ํƒ€์ž… ์ด๋ ˆ์ด์ ธ์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. (erasure๋ฅผ ์ •ํ™•ํžˆ ์–ด๋–ป๊ฒŒ ํ•ด์„ํ•ด์•ผ ํ• ์ง€ ๋ชจ๋ฅด๊ฒ ๋„ค์š”.. ์‚ญ์ œ? ์ง€์›€?) ๊ฐ€์žฅ ๋จผ์ € ๋™๋ฌผ ํ”„๋กœํ† ์ฝœ์„ ์‚ดํŽด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๋™๋ฌผ ํ”„๋กœํ† ์ฝœ์€ associatedtype์œผ๋กœ ๋จน์ดํƒ€์ž…๊ณผ ์ƒ์‚ฐํ’ˆํƒ€์ž…์ด ์žˆ๊ณ , ๋ฉ”์„œ๋“œ๋กœ ๋จน์ดํƒ€์ž…์„ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋ฐ›๋Š” eat, ์ƒ์‚ฐํ’ˆ ํƒ€์ž…์„ ๋ฐ˜ํ™˜ํ•˜๋Š” produce ๋ฉ”์„œ๋“œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. pro.. 2022. 7. 11.
[WWDC 2022] ์ œ๋„ˆ๋ฆญ๊ณผ ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•ด ์ฝ”๋“œ ์ถ”์ƒํ™”ํ•˜๊ธฐ (feat. some,any) (Embrace Swift generics) ์•ˆ๋…•ํ•˜์„ธ์š” Foma ์ž…๋‹ˆ๋‹ค! ์˜ค๋Š˜์€ WWDC 2022์—์„œ ์ œ๋„ˆ๋ฆญ๊ณผ ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ •์„(?)์œผ๋กœ ์ฝ”๋“œ๋ฅผ ์ถ”์ƒํ™”ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ๋‹ค๋ฃฌ Embrace Swift generics ์„ธ์…˜์— ๋Œ€ํ•ด ์ •๋ฆฌํ•ด ๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๋ฐ”๋กœ ์‹œ์ž‘ํ• ๊ฒŒ์š”~ (์ œ ๋ฐฉ์‹๋Œ€๋กœ ํ•ด์„ํ•˜์—ฌ ์ •๋ฆฌํ•˜๋Š” ๊ฒƒ์ด๋‹ˆ ํ‹€๋ฆฐ ์ ์ด๋‚˜ ๊ถ๊ธˆํ•œ ์ ์ด ์žˆ๋‹ค๋ฉด ์–ธ์ œ๋“  ๋Œ“๊ธ€๋กœ ์•Œ๋ ค์ฃผ์„ธ์š”!) Model with concrete types ๊ฐ€์žฅ ๋จผ์ € ์–ด๋– ํ•œ ๊ฒƒ๋„ ์ถ”์ƒํ™”๋‚˜ ์ œ๋„ˆ๋ฆญ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ์žˆ๋Š” ๊ทธ๋Œ€๋กœ ์ฆ‰, ๊ตฌ์ฒด์ ์ธ ํƒ€์ž…์„ ์ด์šฉํ•ด์„œ ๋†์žฅ ์‹œ์Šคํ…œ์„ ๊ตฌํ˜„ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๋†์žฅ์— ์†Œ๊ฐ€ ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๊ณ , ๊ทธ ์†Œ๋Š” ๊ฑด์ดˆ(Hay)๋ฅผ ๋จน๋Š” struct๋ฅผ ์ƒ์„ฑํ•ด ์ฃผ๊ฒ ์Šต๋‹ˆ๋‹ค. struct Cow { func eat(_ food:Hay) {...} } ์ด์ œ ์†Œ๊ฐ€ ๋จน๋Š” ๊ฑด์ดˆ๋Š” ์ž๋ผ๋ฉด ์•Œ.. 2022. 7. 10.
[WWDC 2022] ๊ธฐ์กด UIKit ์•ฑ์— SwiftUI ์ ์šฉํ•˜๊ธฐ (Use SwiftUI with UIKit) ์•ˆ๋…•ํ•˜์„ธ์š” Foma ์ž…๋‹ˆ๋‹ค! ์˜ˆ์ „๋ถ€ํ„ฐ WWDC ๋‚ด์šฉ์„ ์ •๋ฆฌํ•˜๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ ๋“œ๋””์–ด ์˜ค๋Š˜ WWDC์— ๋Œ€ํ•ด ๊ธ€์„ ์ž‘์„ฑํ•˜๊ฒŒ ๋˜๋„ค์š”. WWDC 2022์—์„œ ๊ฐ€์žฅ ๊ด€์‹ฌ์„ ๋Œ์—ˆ๋˜ ์„ธ์…˜์€ UIKit ์•ฑ์— SwiftUI๋ฅผ ์ ์šฉํ•˜๋Š” ์„ธ์…˜์ด์—ˆ๋Š”๋ฐ์š”. ํ•ด๋‹น ์„ธ์…˜์„ ์ง์ ‘ ๊ตฌํ˜„ํ•ด ๋ณด๊ณ  ์ •๋ฆฌํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๋ฐ”๋กœ ์‹œ์ž‘ํ• ๊ฒŒ์š”~ (Xcode 14 Beta๋กœ ์ง„ํ–‰๋˜๊ธฐ ๋•Œ๋ฌธ์— ํ˜น์‹œ ๋ฏธ๋ฆฌ ๊ฒฝํ—˜ํ•˜๊ณ  ์‹ถ์€ ๋ถ„๋“ค์€ ์—ฌ๊ธฐ ์—์„œ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์•„์„œ ์ง„ํ–‰ํ•ด ์ฃผ์„ธ์š”~) Preview UIHostingController UIHostingController๋Š” SwiftUI ๋ทฐ๋ฅผ ํฌํ•จํ•œ UIViewController์ž…๋‹ˆ๋‹ค. UIHostingController๋ฅผ ์ด์šฉํ•˜์—ฌ UIViewController์—์„œ SwiftUI ๋ทฐ๋ฅผ ํŒ์—… ํ˜•์‹์œผ๋กœ ๋„์›Œ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.. 2022. 7. 9.
728x90
๋ฐ˜์‘ํ˜•