2019-04-04 20:11:52 +00:00
The `buildable` folder contains templates with source files that build.
2019-04-04 14:51:28 +00:00
The goal is to turn these templates as Xcode templates. They are part of the Riot project in order to ensure they build
# ScreenTemplate
2020-08-24 12:39:51 +00:00
This is the boilerplate to create a screen that follows the MVVM-C pattern used within the Element app.
2019-04-04 14:51:28 +00:00
2019-04-05 05:57:53 +00:00
To create a screen from this template (before it becomes an Xcode template):
2019-04-04 14:51:28 +00:00
2019-04-04 16:58:32 +00:00
- `./createScreen.sh ScreenFolder MyScreenName`
2019-04-04 14:51:28 +00:00
- Import the created folder in the Xcode project
2019-04-05 05:57:53 +00:00
This will create ScreenFolder within the Riot/Modules. Files inside will be named `MyScreenNameXxx` .
2019-04-04 14:51:28 +00:00
2019-04-15 14:26:28 +00:00
# SimpleScreenTemplate
This is the boilerplate to create a simple screen.
To create a screen from this template (before it becomes an Xcode template):
- `./createSimpleScreen.sh ScreenFolder MyScreenName`
- Import the created folder in the Xcode project
This will create ScreenFolder within the Riot/Modules. Files inside will be named `MyScreenNameXxx` .
2019-04-04 14:51:28 +00:00
# FlowCoordinatorTemplate
The boilerplate to create a root coordinator and its presenter bridge that can be used from Objective-C.
To use it (before it becomes an Xcode template):
2019-04-04 20:11:52 +00:00
- `./createRootCoordinator.sh Folder MyRootCoordinatorName [DefaultScreenName]`
- Import created files in the Xcode project
2022-10-18 13:12:24 +00:00
# SwiftUISimpleScreenTemplate
This is the boilerplate to create a simple SwiftUI screen including view model, screen coordinator, unit and UI tests.
To create a screen from this template (before it becomes an Xcode template):
- `./createSwiftUISimpleScreen.sh ScreenFolder MyScreenName`
- Import created files in the Xcode project
This will create `ScreenFolder` within the `RiotSwiftUI/Modules` . Files inside will be named `MyScreenNameXxx` .
# SwiftUISingleScreenTempalte
This is the boilerplate to create a simple SwiftUI screen including view model, screen coordinator, service, unit and UI tests.
To create a screen from this template (before it becomes an Xcode template):
- `./createSwiftUISingleScreen.sh ScreenFolder MyScreenName`
- Import created files in the Xcode project
This will create `ScreenFolder` within the `RiotSwiftUI/Modules` . Files inside will be named `MyScreenNameXxx` .
# SwiftUITwoScreenTemplate
This is the boilerplate to create two single SwiftUI screens (including view models, screen coordinators, services, unit and UI tests) and a flow coordinator.
To create screens from this template (before it becomes an Xcode template):
- `./createSwiftUITwoScreen.sh TwoScreenFolder MyRootCoordinator FirstScreenName SecondScreenName`
- Import created files in the Xcode project
This will create `TwoScreenFolder` within the `RiotSwiftUI/Modules` .
2019-04-04 20:11:52 +00:00
# Usage example
Following commands:
```
./createScreen.sh MyFlowDir/MyFirstScreenDir MyFirstScreen
./createRootCoordinator.sh MyFlowDir MyFlow MyFirstScreen
```
generate in `Riot/Modules` :
```
Riot/Modules/MyFlowDir
├── MyFirstScreenDir
│ ├── MyFirstScreenCoordinator.swift
│ ├── MyFirstScreenCoordinatorType.swift
│ ├── MyFirstScreenViewAction.swift
│ ├── MyFirstScreenViewController.storyboard
│ ├── MyFirstScreenViewController.swift
│ ├── MyFirstScreenViewModel.swift
│ ├── MyFirstScreenViewModelType.swift
│ └── MyFirstScreenViewState.swift
├── MyFlowCoordinator.swift
├── MyFlowCoordinatorBridgePresenter.swift
└── MyFlowCoordinatorType.swift
```
2019-04-05 05:57:53 +00:00
The generated code is ready to use. The screen provided by `ScreenTemplate` can by displayed by:
2019-04-04 20:11:52 +00:00
```
MyFlowCoordinatorBridgePresenter *presenter = [[MyFlowCoordinatorBridgePresenter alloc] initWithSession:session];
[presenter presentFrom:self animated:YES];
```