-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] add refresh button #139
base: develop
Are you sure you want to change the base?
Conversation
private func triggerRefresh() { | ||
// ํ ํฑ ๋ฐ์ | ||
let generator = UIImpactFeedbackGenerator(style: .light) | ||
generator.impactOccurred() | ||
|
||
// ๋ก๋ฉ ์ํ ํ์ฑํ | ||
isLoading = true | ||
|
||
// ๋ฐ์ดํฐ ์ ๋ฐ์ดํธ ์คํ | ||
viewModel.updateTodayRecord() | ||
|
||
// ๋ก๋ฉ ์ํ ๋นํ์ฑํ (๋๋ ์ด ์๋ฎฌ๋ ์ด์ ) | ||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { | ||
isLoading = false | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ก๋ฉ์ด๋ ๋ฐ์ดํฐ ๊ฐฑ์ ๋ถ๋ถ MainViewModel๋ก ๋๋๊ธฐ์ ๋๋ฌด ์์๊น์?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ณต๊ฐํฉ๋๋ค! ํด๋น ๋ถ๋ถ MainViewModel๋ก ์ฎ๊ฒจ๋ ๋์ง ์์๊น ์ถ์ต๋๋ค!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ ๋ ํด๋น ๋ถ๋ถ์ด ๊ณ ๋ฏผ๋์ด GPT ์ผ์ธํํ ๋ฌผ์ด๋ดค๋๋ฐ ํด๋น ๊ธฐ๋ฅ์ ๋น์ง๋์ค ๋ก์ง๋ณด๋ค ํ๋ฉด ์ฒ๋ฆฌ์ ๊ฐ๊น์ View์ ์ด์ธ๋ฆฐ๋ค๊ณ ํ์๋๊ตฐ์...! ์ฐ์ ์ด๊ฑด ์ด๋๋ก ํฉ์น๊ณ ๋ค์๋ฒ ์ฝ๋ ์์ ์์ ์ฌ๋ ผ์ ํ๋๋ก ํ๊ฒ ์ต๋๋ค!
private func triggerRefresh() { | ||
// ํ ํฑ ๋ฐ์ | ||
let generator = UIImpactFeedbackGenerator(style: .light) | ||
generator.impactOccurred() | ||
|
||
// ๋ก๋ฉ ์ํ ํ์ฑํ | ||
isLoading = true | ||
|
||
// ๋ฐ์ดํฐ ์ ๋ฐ์ดํธ ์คํ | ||
viewModel.updateTodayRecord() | ||
|
||
// ๋ก๋ฉ ์ํ ๋นํ์ฑํ (๋๋ ์ด ์๋ฎฌ๋ ์ด์ ) | ||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { | ||
isLoading = false | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ณต๊ฐํฉ๋๋ค! ํด๋น ๋ถ๋ถ MainViewModel๋ก ์ฎ๊ฒจ๋ ๋์ง ์์๊น ์ถ์ต๋๋ค!
๐ฅ ์์ ํ ๋ด์ฉ
Watch <-> HeatlhStore <-> Phone
์ด ์ฌ์ด์์ ๋ฐ์ดํฐ ๋๊ธฐํ๋๋๋ฐ ์๊ฐ์ด ๊ฑธ๋ฆฌ๋ ๊ฒ์ผ๋ก ์์ ์ด ํ๋ค์ด ๋ณด์ ๋๋ค.
(iOS์ watchOS ๋ฐ์ดํฐ๋ฅผ ์ฐ๊ฒฐ ์ํค๊ณ ๋ณ๋์ ๋ฐ์ดํฐ๋ฅผ ์ค์๊ฐ์ผ๋ก ์ฃผ๊ณ ๋ฐ๋๋ก ํ๋ ๋ฐฉ๋ฒ๋ ์์ง๋ง, ๊ฐ์ธ์ ์ผ๋ก ๋ฐฐ๊ผฝ์ด ๋ ์ปค์ง์ง ์๋๋ผ๊ณ ์๊ฐํฉ๋๋ค. )
@Environment(.scenePhase)์ ์ด์ฉํด์ ๋ฐฑ๊ทธ๋ผ์ด๋์์ ํฌ๊ทธ๋ผ์ด๋๋ก ์ง์ ์์๋ ๋ฐ์ดํฐ๋ฅผ ์๋ก ๋ฐ์์ค๋๋ก ์์ ํ์ต๋๋ค.
์๋ก๊ณ ์นจ ๊ธฐ๋ฅ์ ์ถ๊ฐํ๊ณ ScrollView์ ์ํฅ์ผ๋ก UI๊ฐ ์กฐ๊ธ ๋ฐ๋์ด์ ํผ๊ทธ๋ง๋ฅผ ๋ณด๋ฉด์ ๋น์ทํ๊ฒ ๋ค์ ์์ ํ์ต๋๋ค.
โญ๏ธ PR Point
๐ธ ์คํฌ๋ฆฐ์ท
Simulator.Screen.Recording.-.kopis.-.2025-01-20.at.14.36.30.mp4
๐จ ๊ด๋ จ ์ด์