본문 바로가기

Swift44

[SwiftUI] TaskModifier 코드전문//// TaskModifier.swift// TIL_TCA//// Created by MaraMincho on 5/5/24.//import Foundationimport SwiftUIstruct Message: Decodable, Identifiable { let id: Int let from: String let text: String}struct TaskModifierView: View { @State private var messages = [Message]() var body: some View { NavigationView { List(messages) { message in VStack(alignment: .leading) { .. 2024. 5. 6.
[TCA] day 10 long living Effect (publisher Effect and async/await effect) 코드 전문import ComposableArchitectureimport SwiftUIimport Combineprivate let readMe = """ This application demonstrates how to handle long-living effects, for example notifications from \ Notification Center, and how to tie an effect's lifetime to the lifetime of the view. Run this application in the simulator, and take a few screenshots by going to \ *Device › Screenshot* in the menu, and obse.. 2024. 5. 5.
[TCA] day 10 Effect 취소 (TCA @Shared, Sheet) 코드 전문import ComposableArchitectureimport SwiftUIprivate let readMe = """ This screen demonstrates how one can cancel in-flight effects in the Composable Architecture. Use the stepper to count to a number, and then tap the "Number fact" button to fetch \ a random fact about that number using an API. While the API request is in-flight, you can tap "Cancel" to cancel the effect and prevent \ i.. 2024. 5. 3.
[TCA] TCA 1.10 이후부터의 Shared State의 initRule https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/sharingstate/#Initialization-rules Documentation pointfreeco.github.ioInitalization Rules- Shared타입으로 선언하기 위해서 특별한 Intialize 규칙이 존재- 이 룰은 어떠한 종류의 프로퍼티 래퍼에도 해당됩니다. (vanilSwiftUI에 해당하는 @state, @stateObject 등등)  - non-persited state일 경우 (@shared) sourth of trouth는 부모뷰에 존재한다. - initalzier는 Shared va.. 2024. 5. 2.
[TCA] day 9 Shared State활용한 TodosList 예제 (TCA @Shared, Sheet) 작성개요TCA 1.10부터 SharedState을 관리하는 방식이 달라졌습니다. 이전에 SharedState를 관리하기 위해서 onchange매서드를 통해관리했는데, 이제는 @Shared라는 Macro로 관리하는 방법으로 달라졌습니다. 그래서 이를 공부하고자 글을 작성하게 되었습니다.   코드https://github.com/MaraMincho/MakingFrogWithoutDissecting/tree/main/TIL_TodosWithTCAShared/TIL_TodosWithTCAShared MakingFrogWithoutDissecting/TIL_TodosWithTCAShared/TIL_TodosWithTCAShared at main · MaraMincho/MakingFrogWithoutDissecti.. 2024. 5. 1.
[TCA] day 8 TCA 1.10 이후부터의 Shared State 관리(@Shared) 코드 전문import ComposableArchitectureimport SwiftUIprivate let readMe = """ This case study demonstrates how to use shared data in order to implement a complex sign up flow. The sign up flow consists of 3 steps, each of which can mutate a bit of shared data, and a final \ summary screen. The summary screen also allows the user to make any last minute edits to any of \ the data in the previous s.. 2024. 4. 30.