Application
February 5, 2024 ยท View on GitHub
This doc explains high-level app design with a structural view.
Functional view is in another doc.
Structural View
Arrows represent "uses" relationship.
Further diagrams detail each of the components.
---
title: Layer View
---
graph
UI --> Data
UI --> Controllers --> Data
x[Cross-Layer]
click UI "#ui"
click Controllers "#controllers"
click Data "#data"
click x "#cross-layer"
You can click on the nodes in this diagram.
-
UIimplements everything related to interaction with the user: screens, animations, navigation between the screens. -
Controllersimplement some business logic, usesDatalayer's objects. -
Dataimplements access to the persistence, secure storage, as well as API models for various remote services.
UI
---
title: UI
---
graph
SceneDelegate --> Window --> ViewController
Flow --> ViewController --> Data
ViewController --> View
Flow --> Data
UI layer
-
SceneDelegateandWindoware part of the UIKit. -
A
Flowimplements navigation logic between different screens. It connectsViewControllers together and passes data around them. -
A
ViewControllerimplements single screen logic usingViews as components and data provided from outside (usually aFlowor anotherViewController). -
Both
Flows andViewControllers can useDatalayer to implement conditional logic in the interface.
Controllers
Here are some of the example logic implemented in the controllers layer.
Arrows represent "kind of" relationship.
---
title: Controllers
---
graph LR
C[Controllers] --> OwnerKey[Owner Key]
C --> Wc[Web Connection]
C --> Ca[Claiming App]
C --> St[Safe Transaction]
C --> ...
The controllers are different from the ViewControllers - unlike the connectors between views and models, they help implementing logic that is either compilcated or takes time or multiple steps to complete.
That being said, in many instances the data arrives directly to a ViewController because that's simpler.
Data
Data provides types and APIs to work with them. Much of the application deals with network services.
Arrows below represent "contains" or "kind of" relationship.
---
title: Data
---
graph
Data --> Models[Logic Models]
Data --> CD[Core Data Models]
Data --> Services
Services --> CGW[Client Gateway] --> APIModels[API Models]
Services --> E[Node RPC]
Services --> Relay
Services --> Wc[Wallet Connect]
Services --> Moonpay
Services --> Web3Auth
Data
Logic Models- data types used in the controllers or UICore Data Models- data types for the persistence. All of the types are defined in theModel.xcdatamodelfile.Services- remote api clientsClient Gateway- Safe wallet APINode RPC- implements Ethereum RPC APIRelay- implements the transaction relayWallet Connect- implements connectivity to and from apps and walletsMoonpay- onramping provider.Web3Auth- single-click authentication to connect an owner key
Unfortunately, current project organization is out of place, so you might have difficulty finding the files named by the parts above.
Cross-Layer
Cross-layer objects implement utilities used throughout other layers.
---
title: Cross-Layer
---
graph
Notifs[Notifications / Events]
Analytics
Logging
Configuration
Errors
-
Notifications are used to post interesting events.UIcan observe them and reload the data. -
Analyticsincludes logging events and non-fatal errors withFirebase. Firebase also provides crash-reporting viaCrashlyticsfeature. -
Loggingimplements multi-stage logging system. -
Configurationincludes build-time configuration via.xcconfigfiles,Info.plistand code-level feature flags. It also includesFirebaseremote config. -
Errorsimplement standard data type for user-facing errors.