1์ฝ”

Development/Android

์˜์กด์„ฑ ์ฃผ์ž…์˜ Koin๐Ÿช™ ๋‘ ๋‹ข์„ - 2

์ด๋ฒˆ์—” ์‹ค์ œ๋กœ ํ”„๋กœ๊ทธ๋žจ์— ์˜์กด์„ฑ ์ฃผ์ž…(DI)๋ฅผ ์ ์šฉ์‹œ์ผœ๋ณด๋ฉด์„œ ์‚ฝ์งˆ์˜ ์—ฐ์†์—์„œ ๋Š๊ผˆ๋˜ ์ ๊ณผ ํ•„์š”ํ•œ ๋ถ€๋ถ„์„ ์ž‘์„ฑํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค. 1. Fragment๋ผ๋ฆฌ ViewModel์„ ๊ณต์œ ํ•˜๊ณ  ์‹ถ์„ ๋•Œ! class JoinEntrepreneurFragment: Fragment() { ... private val viewModel: JoinViewModel by sharedViewModel() โ€‹ ... } โ€‹ class JoinMainFragment : SoftKeyboardImplementFragment() { ... private val viewModel: JoinViewModel by sharedViewModel() โ€‹ ... } ์œ„์™€ ๊ฐ™์€ ํ˜•์‹์œผ๋กœ sharedViewModel() ๋ฅผ ์ ์–ด์ค€๋‹ค๋ฉด Fragment๊ฐ„ ..

Android_DevKick
'1์ฝ”' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก