This doc explains high-level app design with a structural view.
Functional view is in another doc.
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.
-
UI
implements everything related to interaction with the user: screens, animations, navigation between the screens. -
Controllers
implement some business logic, usesData
layer's objects. -
Data
implements access to the persistence, secure storage, as well as API models for various remote services.
---
title: UI
---
graph
SceneDelegate --> Window --> ViewController
Flow --> ViewController --> Data
ViewController --> View
Flow --> Data
UI layer
-
SceneDelegate
andWindow
are part of the UIKit. -
A
Flow
implements navigation logic between different screens. It connectsViewController
s together and passes data around them. -
A
ViewController
implements single screen logic usingView
s as components and data provided from outside (usually aFlow
or anotherViewController
). -
Both
Flow
s andViewController
s can useData
layer to implement conditional logic in the interface.
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 ViewController
s - 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
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.xcdatamodel
file.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
objects implement utilities used throughout other layers.
---
title: Cross-Layer
---
graph
Notifs[Notifications / Events]
Analytics
Logging
Configuration
Errors
-
Notification
s are used to post interesting events.UI
can observe them and reload the data. -
Analytics
includes logging events and non-fatal errors withFirebase
. Firebase also provides crash-reporting viaCrashlytics
feature. -
Logging
implements multi-stage logging system. -
Configuration
includes build-time configuration via.xcconfig
files,Info.plist
and code-level feature flags. It also includesFirebase
remote config. -
Errors
implement standard data type for user-facing errors.