-
Notifications
You must be signed in to change notification settings - Fork 0
architecture
Leo edited this page Mar 5, 2023
·
4 revisions
アプリのアーキテクチャは以下のガイドラインを意識しています。
https://developer.android.com/topic/architecture
![スクリーンショット 2023-02-15 14 28 44](https://user-images.githubusercontent.com/16476224/218940816-4c492ccf-ea86-4afb-b284-2c8917a3cea6.png)
UI LayerはUI 、 Domain LayerはDomain 、 Data LayerはDataに配置しています
![スクリーンショット 2023-02-15 14 39 19](https://user-images.githubusercontent.com/16476224/218942319-2e769057-c501-4dd0-9243-8e45976fe76d.png)
上記のState holdersはViewModelを使う運用にしています。
UI elementsは、ContentPageになります。
-
各環境への切り替えはまだ未実装です.... issue
-
API KEYなどの秘匿情報の管理は、はまだ未実装です.... issue
-
ui layer
- シンプルなロジックであれば
ViewModel
で直接Repositoryを呼び出します。 - エラーハンドリング(try catch)は
ViewModel
で行います。 - Threading
- ViewModelはStateHolderに該当します。
- ほとんどのView Logicは「Xaml & DataBinding」で制御します
- NavigationはShellを使います
- シンプルなロジックであれば
-
domain layer
- Mauiフレームワークに依存しない、Pure C#のコードで実装する
- Threading
- Model(record)はこのレイヤで持つ.
- ViewModelで同じロジックを作成したり、複数のRepositoryを呼び出してViewModelの処理が肥大化する場合はXXXUseCaseクラスを作成し処理を切り分ける運用にする。
-
data layer
- 小規模アプリでは、
domain entity
とmapper
は不要かもしれない。data entity
を直接UIレイヤーで使う。 - 異常系は、カスタムExceptionをthrowさせる。
- Threading
- 小規模アプリでは、
パッケージの利用は最小限にしたい
https://github.com/CommunityToolkit/Maui