Skip to content

Commit 5efa471

Browse files
authored
[#421] 위젯 아키텍쳐와 데이터 흐름을 정리한다 (#424)
* docs: 위젯 데이터 아키텍쳐 구성 * docs: 리드미에 위젯 데이터 아키텍쳐 구성
1 parent 1fe8785 commit 5efa471

3 files changed

Lines changed: 97 additions & 2 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ MVVM을 기반으로 하되, ViewModel 상태 관리에는 MVI 형태의 단방
138138
<td align="center">앱 계층</td>
139139
<td align="center">Store 프로토콜</td>
140140
</tr>
141+
<tr>
142+
<td align="center" colspan="2">
143+
<img alt="Widget Architecture" src="./docs/Widget.png" />
144+
</td>
145+
</tr>
146+
<tr>
147+
<td align="center" colspan="2">위젯 데이터 아키텍쳐</td>
148+
</tr>
141149
</table>
142150

143151
## 프로젝트 구조

docs/DevLog.drawio

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<mxfile host="app.diagrams.net" agent="Codex" pages="6">
1+
<mxfile host="Electron" agent="Codex" pages="7">
22
<diagram id="store-protocol-page" name="Store Protocol">
33
<mxGraphModel dx="912" dy="491" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" background="none" math="0" shadow="0">
44
<root>
@@ -632,7 +632,7 @@
632632
</mxGraphModel>
633633
</diagram>
634634
<diagram id="todo-representative-flow-page" name="Todo Representative Flow">
635-
<mxGraphModel dx="764" dy="411" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" background="none" math="0" shadow="0">
635+
<mxGraphModel dx="3142" dy="1889" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" background="none" math="0" shadow="0">
636636
<root>
637637
<mxCell id="500" />
638638
<mxCell id="501" parent="500" />
@@ -716,4 +716,91 @@
716716
</root>
717717
</mxGraphModel>
718718
</diagram>
719+
<diagram id="widget-architecture-page" name="Widget Architecture">
720+
<mxGraphModel dx="1414" dy="850" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1280" pageHeight="420" background="none" math="0" shadow="0">
721+
<root>
722+
<mxCell id="0" />
723+
<mxCell id="1" parent="0" />
724+
<mxCell id="w-data-bg" parent="1" style="rounded=1;arcSize=10;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#B9D7FF;strokeWidth=2;" value="" vertex="1">
725+
<mxGeometry height="360" width="1220" x="30" y="30" as="geometry" />
726+
</mxCell>
727+
<mxCell id="w-service" link="https://github.com/opficdev/SwiftUI_DevLog/blob/main/DevLog/Infra/Service/TodoService.swift" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#64748B;strokeWidth=2;fontColor=#1F2328;fontSize=13;align=center;" value="&lt;b&gt;Todo Data&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Firestore&lt;/span&gt;" vertex="1">
728+
<mxGeometry height="62" width="130" x="58" y="88" as="geometry" />
729+
</mxCell>
730+
<mxCell id="w-repository" link="https://github.com/opficdev/SwiftUI_DevLog/blob/main/DevLog/Domain/Protocol/TodoRepository.swift" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#64748B;strokeWidth=2;fontColor=#1F2328;fontSize=13;align=center;" value="&lt;b&gt;App Data Source&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Todo query&lt;/span&gt;" vertex="1">
731+
<mxGeometry height="62" width="130" x="300" y="88" as="geometry" />
732+
</mxCell>
733+
<mxCell id="w-handler" link="https://github.com/opficdev/SwiftUI_DevLog/blob/main/DevLog/Widget/Sync/WidgetSyncEventHandler.swift" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#EAF2FF;strokeColor=#0A84FF;strokeWidth=2;fontColor=#0B1F33;fontSize=13;align=center;" value="&lt;b&gt;Snapshot Sync&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Today / Heatmap data&lt;/span&gt;" vertex="1">
734+
<mxGeometry height="70" width="150" x="542" y="84" as="geometry" />
735+
</mxCell>
736+
<mxCell id="w-updater" link="https://github.com/opficdev/SwiftUI_DevLog/blob/main/DevLog/Storage/Persistence/WidgetSnapshotUpdater.swift" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#EAF2FF;strokeColor=#0A84FF;strokeWidth=2;fontColor=#0B1F33;fontSize=13;align=center;" value="&lt;b&gt;Snapshot Builder&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;apply rules&lt;/span&gt;" vertex="1">
737+
<mxGeometry height="70" width="150" x="802" y="84" as="geometry" />
738+
</mxCell>
739+
<mxCell id="w-factory" link="https://github.com/opficdev/SwiftUI_DevLog/blob/main/DevLog/Widget/Today/TodayWidgetSnapshotFactory.swift" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#F8FAFC;strokeColor=#0A84FF;strokeWidth=2;fontColor=#1F2328;fontSize=13;align=center;" value="&lt;b&gt;Widget Snapshot&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Today / Heatmap&lt;/span&gt;" vertex="1">
740+
<mxGeometry height="78" width="160" x="1067" y="80" as="geometry" />
741+
</mxCell>
742+
<mxCell id="w-appgroup" link="https://github.com/opficdev/SwiftUI_DevLog/blob/main/DevLog/Widget/Common/WidgetSharedDefaultsStore.swift" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#DCFCE7;strokeColor=#16A34A;strokeWidth=2;fontColor=#14532D;fontSize=13;align=center;" value="&lt;b&gt;App Group UserDefaults&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;JSON snapshot data&lt;/span&gt;" vertex="1">
743+
<mxGeometry height="62" width="160" x="1067" y="288" as="geometry" />
744+
</mxCell>
745+
<mxCell id="w-preference" link="https://github.com/opficdev/SwiftUI_DevLog/blob/main/DevLog/Storage/Persistence/WidgetSnapshotPreferenceStore.swift" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#ECFEFF;strokeColor=#0891B2;strokeWidth=2;fontColor=#164E63;fontSize=13;align=center;" value="&lt;b&gt;Display Preferences&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Today / Heatmap options&lt;/span&gt;" vertex="1">
746+
<mxGeometry height="60" width="210" x="772" y="200" as="geometry" />
747+
</mxCell>
748+
<mxCell id="w-widget-store" link="https://github.com/opficdev/SwiftUI_DevLog/blob/main/DevLogWidget/Common/WidgetSnapshotStore.swift" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#F5F3FF;strokeColor=#7C3AED;strokeWidth=2;fontColor=#1F2328;fontSize=13;align=center;" value="&lt;b&gt;Snapshot Reader&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;read shared snapshot&lt;/span&gt;" vertex="1">
749+
<mxGeometry height="62" width="160" x="802" y="288" as="geometry" />
750+
</mxCell>
751+
<mxCell id="w-provider" link="https://github.com/opficdev/SwiftUI_DevLog/blob/main/DevLogWidget/Today/TodayTodoWidgetProvider.swift" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#F5F3FF;strokeColor=#7C3AED;strokeWidth=2;fontColor=#1F2328;fontSize=13;align=center;" value="&lt;b&gt;Widget Timeline&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;make entry&lt;/span&gt;" vertex="1">
752+
<mxGeometry height="62" width="170" x="542" y="288" as="geometry" />
753+
</mxCell>
754+
<mxCell id="w-entry" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#7C3AED;strokeWidth=2;fontColor=#1F2328;fontSize=13;align=center;" value="&lt;b&gt;Widget Entry&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;snapshot state&lt;/span&gt;" vertex="1">
755+
<mxGeometry height="58" width="130" x="300" y="290" as="geometry" />
756+
</mxCell>
757+
<mxCell id="w-entry-view" parent="1" style="rounded=1;arcSize=14;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#7C3AED;strokeWidth=2;fontColor=#1F2328;fontSize=13;align=center;" value="&lt;b&gt;Widget View&lt;/b&gt;&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;render&lt;/span&gt;" vertex="1">
758+
<mxGeometry height="58" width="130" x="58" y="290" as="geometry" />
759+
</mxCell>
760+
<mxCell id="w-data-note" parent="1" style="rounded=1;arcSize=10;whiteSpace=wrap;html=1;fillColor=#F8FAFC;strokeColor=#D8E0EA;strokeWidth=1;fontColor=#374151;fontSize=12;align=left;spacingLeft=10;" value="Todo 조회 결과와 사용자 설정이 스냅샷으로 변환됩니다.&lt;div&gt;App Group UserDefaults에 JSON 데이터로 저장된 뒤 위젯 확장에서 읽혀 화면으로 렌더링됩니다.&lt;/div&gt;" vertex="1">
761+
<mxGeometry height="52" width="562" x="58" y="200" as="geometry" />
762+
</mxCell>
763+
<mxCell id="wd-1" edge="1" parent="1" source="w-service" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#0A84FF;strokeWidth=3;" target="w-repository" value="Todo data">
764+
<mxGeometry relative="1" as="geometry" />
765+
</mxCell>
766+
<mxCell id="wd-2" edge="1" parent="1" source="w-repository" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#0A84FF;strokeWidth=3;" target="w-handler" value="Todo page">
767+
<mxGeometry relative="1" as="geometry" />
768+
</mxCell>
769+
<mxCell id="wd-3" edge="1" parent="1" source="w-handler" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#0A84FF;strokeWidth=3;" target="w-updater" value="Widget input">
770+
<mxGeometry relative="1" x="-0.1739" as="geometry">
771+
<mxPoint as="offset" />
772+
</mxGeometry>
773+
</mxCell>
774+
<mxCell id="wd-4" edge="1" parent="1" source="w-updater" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#0A84FF;strokeWidth=3;" target="w-factory" value="Snapshot">
775+
<mxGeometry relative="1" x="-0.2174" as="geometry">
776+
<mxPoint as="offset" />
777+
</mxGeometry>
778+
</mxCell>
779+
<mxCell id="wd-5" edge="1" parent="1" source="w-factory" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#16A34A;strokeWidth=3;" target="w-appgroup" value="Save JSON">
780+
<mxGeometry relative="1" as="geometry" />
781+
</mxCell>
782+
<mxCell id="wd-6" edge="1" parent="1" source="w-preference" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#0891B2;strokeWidth=3;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" target="w-updater" value="Options">
783+
<mxGeometry relative="1" x="-0.0857" as="geometry">
784+
<mxPoint as="offset" />
785+
</mxGeometry>
786+
</mxCell>
787+
<mxCell id="wd-7" edge="1" parent="1" source="w-appgroup" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#7C3AED;strokeWidth=3;edgeStyle=orthogonalEdgeStyle;" target="w-widget-store" value="Read JSON">
788+
<mxGeometry relative="1" x="-0.1048" as="geometry">
789+
<mxPoint as="offset" />
790+
</mxGeometry>
791+
</mxCell>
792+
<mxCell id="wd-8" edge="1" parent="1" source="w-widget-store" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#7C3AED;strokeWidth=3;" target="w-provider" value="Snapshot">
793+
<mxGeometry relative="1" x="-0.0667" y="-1" as="geometry">
794+
<mxPoint as="offset" />
795+
</mxGeometry>
796+
</mxCell>
797+
<mxCell id="wd-9" edge="1" parent="1" source="w-provider" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#7C3AED;strokeWidth=3;" target="w-entry" value="Entry data">
798+
<mxGeometry relative="1" as="geometry" />
799+
</mxCell>
800+
<mxCell id="wd-10" edge="1" parent="1" source="w-entry" style="endArrow=blockThin;endFill=1;endSize=16;html=1;rounded=1;strokeColor=#7C3AED;strokeWidth=3;" target="w-entry-view" value="Render">
801+
<mxGeometry relative="1" as="geometry" />
802+
</mxCell>
803+
</root>
804+
</mxGraphModel>
805+
</diagram>
719806
</mxfile>

docs/Widget.png

85.9 KB
Loading

0 commit comments

Comments
 (0)