๊ธ€ ์ž‘์„ฑ์ž: ๊ฐœ๋ฐœํ•˜๋Š” ํ›ˆ์ด

2022.01.16 ์˜ค๋Š˜์˜ ๋ฐฐ์›€

์˜ค๋Š˜ ํ•œ ์ผ.

  • Disposables.create ์ฝ”๋“œ ๋œฏ์–ด๋ณด๊ธฐ
  • Rx ๊ณต๋ถ€
  • ๋ฉด์ ‘ ์ค€๋น„ 

์˜ค๋Š˜ ์ƒˆ๋กœ ๋ฐœ๊ฒฌํ•œ ๊ฒƒ.

  • Extension์— ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋Š” ํ”„๋กœํผํ‹ฐ์˜ ์ข…๋ฅ˜๋Š” ์—ฐ์‚ฐ ํ”„๋กœํผํ‹ฐ, ํƒ€์ž… ์Šคํƒœํ‹ฑ ์ €์žฅ ํ”„๋กœํผํ‹ฐ์ด๋‹ค. ํƒ€์ž… ํด๋ž˜์Šค ์ €์žฅ ํ”„๋กœํผํ‹ฐ๋Š” ์ถ”๊ฐ€๊ฐ€ ์•ˆ๋จ.
  • ํ”„๋กœํ† ์ฝœ์˜ extension์—๋Š” ์Šคํƒœํ‹ฑ ์ €์žฅ ํ”„๋กœํผํ‹ฐ๋„ ์ถ”๊ฐ€๊ฐ€ ์•ˆ๋œ๋‹ค. 
  • ํด๋กœ์ €์™€ ๊ฐ’ ์บก์ณ์— ๋Œ€ํ•œ ๋ฉ”๋ชจ๋ฆฌ ๋ ˆ๋ฒจ ์ง€์‹์„ ์•„์ฃผ ์ž์„ธํžˆ ์จ๋†“์€ ๋‹ต๋ณ€์ด ์žˆ๋‹ค. ๋‚ด์ผ ์ฝ์–ด๋ด์•ผ๊ฒ ๋‹ค.
 

Swift function object wrapper in apple/swift

After reading: https://github.com/rodionovd/SWRoute/wiki/Function-hooking-in-Swift https://github.com/rodionovd/SWRoute/blob/master/SWRoute/rd_get_func_impl.c I understood that Swift function po...

stackoverflow.com

  • ๋žœ๋”๋ง์— ๋Œ€ํ•œ ๊ฐ€๋ ค์šด ๋ถ€๋ถ„์„ ๊ธ์–ด์ค„ ๊ธ€๋„ ์ฐพ์•˜๋‹ค. ์ „์ฒด ๋žœ๋”๋ง ํ”„๋กœ์„ธ์Šค๋ฅผ ์ž˜ ์ •๋ฆฌํ•ด๋‘” ๊ฒƒ ๊ฐ™์œผ๋‹ˆ ์ด๊ฒƒ๋„ ๋‚ด์ผ ์ฝ์–ด๋ณด์ž.
 

Full analysis of IOS rendering - Develop Paper

I hope that through this article, I will sort out the content related to the rendering principle in IOS from the beginning to the end. I will start from the principle of computer rendering, and slowly talk about the principle and framework of IOS rendering

developpaper.com

  • Traits๋Š” ์„ธ ์ข…๋ฅ˜๊ฐ€ ์žˆ๋‹ค. single, maybe, compeletable. single์€ success or error ์ด๊ณ , completable์€ completed or error, maybe๋Š” success, completed, error ๋ชจ๋‘ ๋ฐฉ์ถœํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์–˜๋„ค๋“ค์€ ํ•œ๋ฒˆ ๋ฐฉ์ถœํ•˜๊ณ  ๊ทธ๋Œ€๋กœ completed๊ฐ€ ๋ฐฉ์ถœ๋˜๋ฉด์„œ ์ข…๋ฃŒ๋œ๋‹ค.
  • ์„œ๋ธŒ์ ํŠธ ์•ˆ์—๋Š” _observers ํ”„๋กœํผํ‹ฐ๊ฐ€ ์žˆ์–ด์„œ ์—ฌ๊ธฐ์— ์˜ต์ €๋ฒ„๋“ค์„ ๋ชจ์•„๋‘๊ณ  ๋™์ผํ•œ ์ด๋ฒคํŠธ๋ฅผ ๋ชจ๋‘์—๊ฒŒ ๋ฐฉ์ถœ ํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ทธ๋ƒฅ observable์€ ๋งค๋ฒˆ create๋ฅผ ์‹คํ–‰ํ•ด์„œ ์ด๋ฒคํŠธ๊ฐ€ ์ฒ˜์Œ๋ถ€ํ„ฐ ๋ฐฉ์ถœ๋œ๋‹ค. 
  • Variables๋Š” BehaviorSubject๋ฅผ ๋ž˜ํ•‘ํ•ด์„œ ๊ฐ’์„ ์ƒํƒœ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด์ด๋‹ค.
  • bind๋Š” next๋งŒ, driver๋Š” next + ๋ฉ”์ธ ์Šค๋ ˆ๋“œ ๋ณด์žฅ, subscribe๋Š” next, error, completed ๊ฐ€๋Šฅ 
  • subscribe๋„ ์‚ฌ์‹ค์€ ์˜คํผ๋ ˆ์ดํ„ฐ์ด๋‹ค. ๋‚ด๋ถ€์—์„œ ์˜ต์ €๋ฒ„๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์ƒ์„ฑํ•œ ์˜ต์ €๋ฒ„๋ฅผ ์ƒˆ๋กœ์šด ์˜ต์ €๋ฒ„๋ธ” ์ธ์Šคํ„ด์Šค์— ์ธ์ž๋กœ ์ฃผ์–ด์„œ subscription์„ ์ƒ์„ฑํ•œ๋‹ค. 
  • share๋Š” ์˜ต์ €๋ฒ„๋ธ”์ด ํ•ญ์ƒ ์ƒˆ๋กญ๊ฒŒ create๋ฅผ ํ˜ธ์ถœํ•˜์ง€ ์•Š๊ฒŒ ํ•˜๊ณ  ์ด๋ฏธ ๋งŒ๋“ค์–ด์ ธ ์žˆ๋Š” subscription์„ ๋ฐ˜ํ™˜ํ•ด ์—ฌ๋Ÿฌ ์˜ต์ €๋ฒ„๊ฐ€ ํ•œ ์‹œํ€€์Šค๋ฅผ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋„๋กํ•œ๋‹ค.
  • UIKit์€ thread-safeํ•˜์ง€ ์•Š๊ฒŒ ์„ค๊ณ„๋˜์–ด์žˆ๋‹ค. ์˜คํžˆ๋ ค thread-safeํ•˜๊ฒŒ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด ์•ฑ์˜ ์„ฑ๋Šฅ์„ ์ €ํ•˜์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค. ์Šค๋ ˆ๋“œ๋งˆ๋‹ค ๋Ÿฐ๋ฃจํ”„๋ฅผ ๋‹ค๋ฅด๊ฒŒ ๊ฐ€์ง€๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— thread-safeํ•˜๊ฒŒ ๋งŒ๋“ค๋ ค๋ฉด ์–ด๋”˜๊ฐ€์—์„œ ๋ฝ์„ ๋ฐ˜๋“œ์‹œ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๊ณ  ๋Ÿฐ๋ฃจํ”„ ์‚ฌ์ดํด์˜ ํƒ€์ด๋ฐ์ด ์ œ๊ฐ๊ฐ์ด ๋  ์ˆ˜ ์žˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด ํ•œ์ชฝ ๋Ÿฐ๋ฃจํ”„์—์„œ๋Š” ๋ทฐ๋ฅผ ์ง€์› ์ง€๋งŒ ์•„์ง ๋Ÿฐ๋ฃจํ”„๊ฐ€ ์•ˆ๋๋‚˜์„œ ํ™”๋ฉด์— ๋‚จ์•„์žˆ์„ ๋•Œ, ์‚ฌ์šฉ์ž๊ฐ€ ๋ทฐ๋ฅผ ํ„ฐ์น˜ํ•˜๊ณ  ํ•ด๋‹น ์ด๋ฒคํŠธ๊ฐ€ ๋ณ„๋„์˜ ๋Ÿฐ๋ฃจํ”„์— ๋“ค์–ด๊ฐ€๋ฉด ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธฐ๊ฒŒ๋œ๋‹ค. 
  • ํ™”๋ฉด์— ์ปจํ…์ธ ๊ฐ€ ๋ณด์—ฌ์ง€๊ธฐ ๊นŒ์ง€ App -> Render Server -> GPU -> Display์˜ ๊ณผ์ •์„ ๊ฑฐ์นœ๋‹ค. ์ฆ‰ ํ™”๋ฉด์€ ํ•œ๋ฒˆ์— ์ง  ํ•˜๊ณ  ๊ทธ๋ ค์ง€๋Š”๊ฒŒ ์•„๋‹ˆ๋‹ค. ๋งŒ์•ฝ ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ์—์„œ ๋™์‹œ์— Render Server์— ๋ Œ๋”๋งํ•  ์ •๋ณด๋ฅผ ์ปค๋ฐ‹ํ•˜๋ฉด ๋™์‹œ๋‹ค๋ฐœ์ ์œผ๋กœ ๋žœ๋”๋ง ํŒŒ์ดํ”„๋ผ์ธ๋ฐ ์ •๋ณด๊ฐ€ ๋“ค์–ด์˜ค๊ฒŒ ๋˜๊ณ  ์ด๊ฑด 1/60์ดˆ ์•ˆ์— App ๋ถ€ํ„ฐ Display๊นŒ์ง€ ๊ฐ€๋Š” ํ•œ ์‚ฌ์ดํด์„ ๋งˆ์น˜์ง€ ๋ชปํ•˜๊ฒŒ ํ•  ์ˆ˜๋„ ์žˆ๋‹ค. 

์˜ค๋Š˜ ๋Š๋‚€ ๊ฒƒ.

  • ๊ณต๋ถ€๋Š” ํ•ด๋„ํ•ด๋„ ๋์ด ์—†๋‹ค.. ๋ญ”๊ฐ€ ํ•œ ๋‘ ๋ถ€๋ถ„์”ฉ ํผ์ฆ์ด ์•ˆ๋งž์ถฐ์ง€๋Š” ๋Š๋‚Œ์ธ๋ฐ ์•„์ง ์•Œ์•„์•ผํ• ๊ฒŒ ๋” ๋งŽ์€๊ฐ€๋ณด๋‹ค!
  • ๊ฐ๊ธฐ๊ธฐ์šด์ด ์žˆ๋Š”์ง€ ์ปจ๋””์…˜์ด ๊ณ„์† ์•ˆ์ข‹๋‹คใ…  ๊ธด ๋ฉด์ ‘๊ธฐ๊ฐ„์„ ๊ฒฌ๋ŽŒ๋‚ด์•ผํ•˜๋‹ˆ๊นŒ ์ข€๋งŒ ์ž˜ ๋ฒ„ํ‹ฐ์ž!!
  • 2์›”์ด ๋˜๊ธฐ ์ „์— ๋‹ค ๋งˆ๋ฌด๋ฆฌํ•˜๊ณ  ์‹ถ๋‹ค! ๋„ˆ๋ฌด ํž˜๋“ค์–ด~~์ œ๋ฐ”๋ฅด~~~

๋‚ด์ผ์˜ ๊ณ„ํš.

  • ๋ฉด์ ‘์ค€๋น„

์˜ค๋Š˜์˜ ๊ฐ์‚ฌ.

  • ์˜ค๋Š˜ ์ €๋… ๋ฉ”๋‰ด๋Š” ํƒ์›”ํ•œ ์„ ํƒ์ด์—ˆ์Šต๋‹ˆ๋‹ค.. ๋ง›์žˆ๋Š”๊ฑฐ ๋จน๊ฒŒ ํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ด์š”!