#1 ๊ฐ์
์ฝ๋ ์ต์ ํ๋ฅผ ํ๊ธฐ ์์ ๋น์ฅ ํ์์๋, ๊ณ๋ฅต๊ณผ๋ ๊ฐ์ ์ฝ๋ ์ ๋ถ ์ ๊ฑฐํ๋ค. ์ผ๋ก ๋จธ์คํฌ์ ์ฌ๊ณ ๋ฒ์ ์ํ๋ฉด, "์ด๊ฑด ๊ฒฐ๊ตญ ๋ค์ ๋ฃ์ด์ผ ํ ๊ฒ ๊ฐ์๋ฐ?"๋ผ๋ ์๊ฐ์ด ๋ค์ง ์์ผ๋ฉด ์ถฉ๋ถํ ์ ๊ฑฐํ์ง ์์ ๊ฒ์ด๋ฏ๋ก ์ ๋ง ์ฒ ์ ํ๊ฒ ์ ๊ฑฐํ๋ค.
#2 ์ฝ๋ ์ค๋ํซ
#2-1 ์์ ํ๋กํผํฐ
[Kotlin] ์์ ํ๋กํผํฐ (Delegated properties)
#1 Delegated properties#1-1 ๊ฐ์ Delegated properties | Kotlin kotlinlang.org์์ ํ๋กํผํฐ๋, getter์ setter ๋ก์ง์ ๋ค๋ฅธ ํด๋์ค์ ์์(delegate)ํ๋ ์ฝํ๋ฆฐ ํ๋กํผํฐ๋ฅผ ์๋ฏธํ๋ค. ๋ณธ ๊ฒ์๊ธ์์๋ ์์ ํ๋กํผ
kenel.tistory.com
์์ ๊ฐ์ด ์์ ํ๋กํผํฐ์ ๋ํด ๊ณต๋ถํด๋๊ณ ์ ์ ํ๋ก์ ํธ์๋ ์ ์ฉ์ ํ์ง ์์์๋ค. ์ด์ ๋ผ๋ ์ ์ฉํ๋ค.
#2-2 ์์ ํ๋กํผํฐ ์ฌ์ฉ
// in NutrientScreen.kt
val inputtedText = remember { mutableStateOf("") }
์ด ์ฝ๋๋ฅผ
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
var inputtedText by remember { mutableStateOf("") }
์์ ๊ฐ์ด ๋ณ๊ฒฝํ๋ค.
#3 ์์ฑ๋ ์ฑ
#3-1 ์คํฌ๋ฆฐ์ท

#3-2 ์ด ๊ฒ์๊ธ ์์ ์ Commit
GitHub - Kanmanemone/nutri-capture-new
Contribute to Kanmanemone/nutri-capture-new development by creating an account on GitHub.
github.com
#3-3 ๋ณธ ํ๋ก์ ํธ์ ๊ฐ์ฅ ์ต์ Commit
GitHub - Kanmanemone/nutri-capture-new
Contribute to Kanmanemone/nutri-capture-new development by creating an account on GitHub.
github.com
'๊ฐ๋ฐ ์ผ์ง ๐ป > Swemo' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| Nutri Capture - Hilt ๋์ (0) | 2025.02.01 |
|---|---|
| Nutri Capture - windowInsetsPadding() ์ฌ์ฉ (0) | 2025.01.29 |
| Nutri Capture - ์์ด์ฝ ์ ์ (1์ฐจ) (1) | 2025.01.12 |
| Nutri Capture - StateFlow๋ก ์ ํ (0) | 2025.01.02 |
| Nutri Capture - ChatBar์ ViewModel ์ฐ๊ฒฐ (0) | 2025.01.02 |