# c++ <--> swift

This is an attempt at architecting the c++ to swift bridge.
We want the bridge to be orthogonal for maximum leverage.

To do that we have to use the Obj-C++ shim layer.
Once we move to Xcode 15, Swift 6 we should be able to get rid of the Obj-C shim.

The trick in swift UI is to start at the UI layer.
For example, SettingsRestoreView.swift
We create the UI with mock data.
This mock data than drives us to the model, more concretely the SettingsRestore.swift

The model is typically created/updated by the client layer. As a reminder the client layer is our dependency layer.
It allows us to use live data or preview data or test data.

This is, imho the easiest architecture as of today, April 2024
Klajd Deda

## Shim layer Tricks

Since the shim layer is mainly used for data transport, we try to create it during it's init method.
Using data from shared instance and such.
Also we name groups \_Shim or \_Model so they are sorted alphabetically better

This keeps the shim small and to the point.
See: B1SettingsRestore as a clear example to all of this.

Make sure to add any obj-c++ header that needs to be accessed by swift 
to the bzrestore-Bridging-Header.h
