iOS ๐ŸŽ

SwiftUI TCA ์žฅ์  - State ์˜ ๋ณ€๊ฒฝ -> UI์— ์ฆ‰์‹œ ๋ฐ˜์˜ - ์ฝ”๋“œ ์ž‘์„ฑ์ด ๊ฐ„๋‹จํ•จ - State ๋ณ€๊ฒฝ ๋กœ์ง ๊ด€๋ฆฌ ์šฉ์ด - ๋ณต์žกํ•œ State์™€ ์ด์— ๋”ฐ๋ฅธ Side Effect ์ฒ˜๋ฆฌ ์šฉ์ด ๋‹จ์  - State ๊ด€๋ฆฌ๊ฐ€ ๋ณต์žกํ•ด ์งˆ์ˆ˜๋ก State ๋ณ€ํ™”์— ๋”ฐ๋ฅธ side effect๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ ์–ด๋ ค์›€ - ์–ด๋ ค์šด ๊ตฌํ˜„ ๋‚œ์ด๋„ ๐ŸฅŠ ๐Ÿ˜ซ TCA Binding public func binding( get: @escaping (_ state: ViewState) -> Value, send valueToAction: @escaping (_ value: Value) -> ViewAction ) -> Binding { ObservedObject(wrappedValue: self) .projectedValue[get: ...
๋ณ„๋‹ค๋ฅธ ์„ค๋ช… ์—†์ด๋„ ์‚ฌ์šฉ์ž๊ฐ€ ํ•ด๋‹น UI๊ฐ€ ๋ฌด์—‡์„ ์˜๋ฏธํ•˜๋Š”์ง€, ์–ด๋–ค ๊ธฐ๋Šฅ์„ ํฌํ•จํ•˜๋Š”์ง€ ์•Œ๊ฒŒ๋” ux๊ฐ€ ๊ณ ๋ ค ๋˜๋ฉด ์ข‹๊ฒ ์ง€๋งŒ ์„ค๋ช…์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ๋„ ์žˆ์–ด์š”. ์ด ์„ค๋ช…์„ ๋ณด์—ฌ์ฃผ๊ธฐ ์œ„ํ•ด TipKit์„ ์‚ฌ์šฉํ•ด ๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์ด๋“œ ํ”„๋กœ์ ํŠธ๋ผ minimum target iOS 17๋กœ ์„ค์ •ํ•ด ๋†“๊ณ  ํ•ด๋ณด๊ณ  ์‹ถ์€๊ฑฐ ๋‹ค ํ•ด๋ณด๊ณ  ์žˆ์–ด์š” ์•„์ด ์ข‹์•„๋ผ TipKit๊ณผ ๊ฐ™์€ ToolTip์ด ํ•„์š”ํ•œ๋ฐ ๋ฒ„์ „์ด ์•ˆ๋˜์‹œ๋ฉด ์•„๋ž˜ ๊ธ€์—์„œ ํˆด ํŒ ๊ทธ๋ฆฌ๋Š” ๋ฐฉ๋ฒ• ์ฐธ๊ณ ํ•ด ๋ณด์„ธ์š”! > 2023.11.06 - [SwiftUI] - [SwiftUI] Shape path๋กœ Tooltip ๊ทธ๋ฆฌ๊ธฐ What is TipKit Tipkit์€ iOS 17 ๋ถ€ํ„ฐ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ํ”„๋ ˆ์ž„์›Œํฌ๋กœ ์• ํ”Œ์ด ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์•ฑ์—์„œ ์‚ฌ์šฉ์ž์—๊ฒŒ ์„ค๋ช…์ด๋‚˜ ์•ˆ๋‚ด๋ฅผ ํ‘œ์‹œํ•˜๋Š”๋ฐ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์–ด..
Scope๋ž€? ์ด์ „ ํ‘œํ˜„ ๋ฐฉ์‹ struct Scope where Child : ReducerProtocol ํ˜„์žฌ ํ‘œํ˜„ ๋ฐฉ์‹ struct Scope: Reducer parent domain์„ child domain์œผ๋กœ ๋ณ€๊ฒฝ -> ํ•˜์œ„ ๋„๋ฉ”์ธ์—์„œ child reduce๋ฅผ ์‹คํ–‰ ์‹œํ‚ด ํฐ ๊ทœ๋ชจ์˜ feature์„ ์ž‘์€ ๋‹จ์œ„๋กœ ์ชผ๊ฐœ๊ฑฐ๋‚˜ ํ•ฉ์น  ์ˆ˜ ์žˆ์Œ ์ž‘์€ ๋‹จ์œ„์˜ feature๋Š” ํฐ ๊ทœ๋ชจ์˜ feature ๋ณด๋‹ค ์ดํ•ดํ•˜๊ธฐ ์‰ฌ์šฐ๋ฉฐ test ๋ฐ ๋ชจ๋“ˆํ™”๋œ ๋ฐฉ์‹์œผ๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์Œ Scope ์ƒ์„ฑ @inlinable public init( state toChildState: WritableKeyPath, action toChildAction: AnyCasePath, @ReducerBuilder child: () -> Child..
์ถœ์ฒ˜ ๋ฐ ์ฐธ๊ณ  ์‚ฌ์ดํŠธ https://axiomatic-fuschia-666.notion.site/Chapter-3-TCA-2-c56b24efb2154dad9ed8e54139247024 Chapter 3. TCA์˜ ๊ธฐ๋ณธ๊ฐœ๋…(2) ์•ž์„  ์žฅ์—์„œ ์šฐ๋ฆฌ๋Š” ์•ฑ์˜ ์ƒํƒœ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” State์™€ ์ด๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜๋‹จ์ธ Action, ๊ทธ Action์˜ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๊ณ  ์ƒํƒœ์˜ ๋ณ€๊ฒฝ์„ ์ฒ˜๋ฆฌํ•˜๋Š” Reducer์„ ์•Œ์•„๋ณด๋ฉฐ, TCA์—์„œ์˜ ๋ฐ์ดํ„ฐํ๋ฆ„์— ๋Œ€ํ•ด์„œ ์‚ดํŽด๋ณด์•˜์Šต๋‹ˆ axiomatic-fuschia-666.notion.site What is Store ๋Ÿฐ ํƒ€์ž„๋™์•ˆ Reducer์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ์ฐธ์กฐ ํƒ€์ž… ๊ฐ์ฒด ์•ฑ์˜ State, Action์„ ๊ด€๋ฆฌ State์˜ ๋ณ€ํ™” ๊ฐ์ง€ ์•ก์…˜ ์ฒ˜๋ฆฌ let store: Store public ty..
์ถœ์ฒ˜ ๋ฐ ์ฐธ๊ณ  ์‚ฌ์ดํŠธ https://axiomatic-fuschia-666.notion.site/Chapter-3-TCA-2-c56b24efb2154dad9ed8e54139247024 Chapter 3. TCA์˜ ๊ธฐ๋ณธ๊ฐœ๋…(2) ์•ž์„  ์žฅ์—์„œ ์šฐ๋ฆฌ๋Š” ์•ฑ์˜ ์ƒํƒœ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” State์™€ ์ด๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜๋‹จ์ธ Action, ๊ทธ Action์˜ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๊ณ  ์ƒํƒœ์˜ ๋ณ€๊ฒฝ์„ ์ฒ˜๋ฆฌํ•˜๋Š” Reducer์„ ์•Œ์•„๋ณด๋ฉฐ, TCA์—์„œ์˜ ๋ฐ์ดํ„ฐํ๋ฆ„์— ๋Œ€ํ•ด์„œ ์‚ดํŽด๋ณด์•˜์Šต๋‹ˆ axiomatic-fuschia-666.notion.site Effect๋ž€? Action์ด ๋ฐ˜ํ™˜ํ•˜๋Š” ํƒ€์ž…์„ ๋œปํ•˜๋ฉฐ Action์„ ๊ฑฐ์นœ ๋ชจ๋“  ๊ฒฐ๊ณผ๋ฌผ์„ ์˜๋ฏธํ•œ๋‹ค. ๋น„๋™๊ธฐ ์ž‘์—…์ด๋‚˜ ์™ธ๋ถ€ ์ž‘์šฉ์— ์˜ํ•ด ๋ฐœ์ƒํ•˜๋Š” Side Effect๋Š” ์–ด๋–ค ์ฒ˜๋ฆฌ ์ดํ›„ ์˜ˆ์ƒ์น˜ ๋ชปํ•˜๊ฒŒ ์–ป์€ ๊ฒฐ๊ณผ๋ฌผ์„..
ํ”„๋ฆฌ๋ทฐ์—์„œ not building -Onone๋กœ ๋กœ๋“œ๊ฐ€ ์•ˆ๋˜๋ฉด Edit Scheme ๋ˆ„๋ฅด๊ณ  Build Configuration ์—์„œ Debug๋กœ ๋ณ€๊ฒฝํ•ด์ฃผ์„ธ์š” ํ…Œ์ŠคํŠธ ํ•œ๋‹ค๊ณ  ์ž ์‹œ ๋ฐ”๊ฟจ๋‹ค๊ฐ€ ๊นŒ๋จน๊ณ  ํ”„๋ฆฌ๋ทฐ ์ผœ๋‹ˆ ์•ˆ๋˜์„œ ๋‹นํ™ฉ;; ํ”„๋ฆฌ๋ทฐ ๋„๋Œ€์ฒด ์–ด๋–ป๊ฒŒ ๊ตฌํ˜„๋˜์–ด ์žˆ๋Š”๊ฑด์ง€ ์‹ ๊ธฐ
.overlay( Rectangle() .stroke(PWColor.gray100, lineWidth: 1) ) // .border(PWColor.gray100, width: 1) ์•„๋ž˜border์„ ์‚ฌ์šฉํ•˜๋ฉด frame์œผ๋กœ ์ธ์‹ํ•˜๊ฒŒ ๋จ. ํ•ด๋‹น ์˜์—ญ ๊นŒ์ง€ ์žกํ˜€์„œ VStack์œผ๋กœ ์Œ“์œผ๋ฉด ์ค‘๊ฐ„์€ 2๊ฐ€ ๋จ
TCA๋ฅผ ๊ณต๋ถ€ํ•˜๋‹ค๊ฐ€ Timer ์˜ˆ์‹œ๋กœ ๋ฌด์—‡์„ ๊ตฌํ˜„ํ•˜๋ฉด ์ข‹์„๊นŒ ์ƒ๊ฐํ•ด ๋ดค๋”๋‹ˆ ์‡ผํ•‘๋ชฐ ์•ฑ์ด ๋– ์˜ค๋ฅด๋”๋ผ๊ตฌ์š”! ์˜ค๋Š˜ ์ž์ •๊นŒ์ง€์˜ ๋‚จ์€ ์‹œ๊ฐ„์„ ๊ณ„์‚ฐํ•ด์„œ ์˜ค๋Š˜์ด ์ง€๋‚˜๋ฉด ๊ตฌ๋งคํ•  ์ˆ˜ ์—†๋„๋ก ๋ฒ„ํŠผ์„ ๋น„ํ™œ์„ฑํ™” ์‹œํ‚ฌ๊ฑฐ์—์š”. ํƒ€์ด๋จธ๋ฅผ ํ‘œ์‹œํ•˜๋Š” ์ € ๋ถ€๋ถ„์ด ๊ตฌ๋งค ๋ฒ„ํŠผ์ž…๋‹ˆ๋‹ค. ๊ตฌํ˜„ํ•ด ๋†“๊ณ  ๋ณด๋‹ˆ ํƒ€์ด๋จธ UI์™€ ๊ตฌ๋งคํ•˜๊ธฐ ๋ฒ„ํŠผ์„ ๋ณ„๋„๋กœ ๋ถ„๋ฆฌํ•  ๊ฑธ ๊ทธ๋žฌ์–ด์š” ๐Ÿฅฒ State struct State: Equatable { var isTimerOn = false var leftTime = "00:00:00" var isBuyButtonDisabled = true } isTimerOn์ด true๊ฐ€ ๋˜๋ฉด ํƒ€์ด๋จธ๋ฅผ ์‹œ์ž‘ํ•˜๊ณ  false๊ฐ€ ๋˜๋ฉด ํƒ€์ด๋จธ๋ฅผ cancel ์‹œ์ผœ์ค๋‹ˆ๋‹ค. leftTime์€ ๋ฒ„ํŠผ ์˜์—ญ์˜ ์‹œ๊ฐ„ ๋ถ€๋ถ„์— ํ‘œ์‹œ๋  ์ŠคํŠธ๋ง ๊ฐ’์ด์—์š”. isBuy..
fram
'iOS ๐ŸŽ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (2 Page)