Repository navigation
PresentationShared의 View 구성 요소와 렌더링 입력을 분리한다 - #946
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 연관된 이슈
🎯 의도
계산 프로퍼티로 구성한 내부 View는 그 안에서 읽은 상태가 바뀌면 부모 View의 body 전체가 다시 평가되는 구조
상태 변화로 재평가가 필요한 영역만 별도 View로 분리하고, 해당 상태를 부모가 아닌 분리한 View의 body에서 읽도록 구성하여 부모 body의 재평가 범위를 줄이는 것
📝 작업 내용
📌 요약
TodoListView,TodoEditorView에서 상태를 읽는 영역을 같은 파일의 private View로 분리🔍 상세
TodoListViewstore를 전달받는 private View로 분리TodoListContent: 기존todoListContent계산 프로퍼티,todos,isLoading,hasMore를 읽어 목록 구성, 삭제 토스트 표시TodoListTopBar: 기존topBar계산 프로퍼티,category,isSearching을 읽어 상단 바 구성,dismiss·openWindow·isiOSAppOnMac과 에디터 열기 담당,matchedGeometryEffect용@Namespace소유TodoListSearchBar: 기존searchBar계산 프로퍼티,searchQuery를 읽어 검색 입력 구성,@FocusState소유,Namespace.ID만 전달받음TodoListFilterHeader: 기존filterHeader계산 프로퍼티,appliedFilterCount와query를 읽어 필터·정렬 메뉴 구성TodoItemRow는 기존대로 값만 전달alert,fullScreenCover로 한정selectTodo는 전달만 하는 함수라 제거하고onSelectTodo를 직접 호출TodoEditorViewEditorInspector: 기존.inspector클로저 안의Group·switch,inspectorContent,isInspectorPresented를 읽는 인스펙터 내용을store를 전달받는 private View로 분리, 저장 클로저 없이.upsertTodo를 직접 전송ToolBar:movesActionsToInspector를 부모에서 제거하고isWideLayout을 전달받아store.isInspectorPresented와 함께showsActions를 직접 계산ContentView:editorHeaderHeight와safeAreaInsets를 읽어minimumHeight를 직접 계산하고GeometryReader의 높이만 전달받음isWideLayout은 인스펙터 컬럼 안에서horizontalSizeClass가 달라질 수 있어 부모에서 계산해 전달TitleField,ModePicker,EditorToolbarActions는 이미store를 받아 자체 body에서 상태를 읽고 있어 변경 없음onChange(of: store.saveResult)는 성공 콜백을 소유하므로 부모에 유지Tags.swift는Tag,TagList가 Store가 아닌 값만 받으므로 변경 없음TodoPropertiesView,TodoDetailView는 이슈가 지정한 파일이 아니므로 범위에서 제외📸 영상 / 이미지 (Optional)
Instruments 측정 (View Body)
View Body (Legacy), 변경 전후 각 5회 교차 측정 후 중앙값 비교, 괄호는 5회 측정 범위이슈목록 진입 후 검색 열기 ↔ 취소 10회+로 편집기 진입 후미리보기↔작성전환 10회, 닫기목록 화면 (검색 열기 ↔ 취소 10회)
TodoListView(아래 4개 영역 포함)TodoListContentTodoListTopBarTodoListSearchBarTodoListFilterHeaderItemActionButtonTodoItemRowtodoListContent,topBar,searchBar,filterHeader가TodoListView의 계산 프로퍼티로 부모 body 안에서 평가되어 별도 측정값이 없고, 변경 전TodoListView값에 모두 포함TodoListViewbody 평가 횟수가 75회에서 3회로 감소ItemActionButton)의 평가 횟수 감소TodoItemRow는 측정 범위가 겹쳐 차이로 보지 않음편집기 화면 (
미리보기↔작성전환 10회, 닫기)TodoEditorView(.inspector클로저 포함)EditorInspectorToolBarEditorToolbarActions.inspector클로저가TodoEditorView의 body 안에서 평가되어 별도 측정값이 없고, 변경 전TodoEditorView값에 포함ToolBar,EditorToolbarActions는 측정 범위가 겹쳐 차이로 보지 않음TodoEditorView는 부모 body가saveResult,isInspectorPresented, 알림 상태를 계속 읽는 구조ContentView,TodoPropertiesView,ModePicker,TitleField는 이번 측정 대상에서 제외