element-ios/Tools/Templates
Mauro Romito 9c13228c74 update license 2024-09-25 12:24:52 +02:00
..
buildable update license 2024-09-25 12:24:52 +02:00
README.md Release 1.9.10 (#7019) 2022-11-01 14:14:46 +03:00
createRootCoordinator.sh Productivity: Tweak templates a bit more 2019-04-05 08:40:10 +02:00
createScreen.sh Productivity: Tweak templates: No comments in a storyboard 2019-04-05 08:52:59 +02:00
createSimpleScreen.sh Template: Add SimpleScreenTemplate 2019-04-15 17:52:55 +02:00
createSwiftUISimpleScreen.sh Add a simple screen SwiftUI template. 2022-01-28 15:34:46 +00:00
createSwiftUISingleScreen.sh Merge together SwiftUI template model files and update folder structure. 2021-12-07 16:11:31 +02:00
createSwiftUITwoScreen.sh Merge together SwiftUI template model files and update folder structure. 2021-12-07 16:11:31 +02:00

README.md

The buildable folder contains templates with source files that build.

The goal is to turn these templates as Xcode templates. They are part of the Riot project in order to ensure they build

ScreenTemplate

This is the boilerplate to create a screen that follows the MVVM-C pattern used within the Element app.

To create a screen from this template (before it becomes an Xcode template):

  • ./createScreen.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.

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.

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):

  • ./createRootCoordinator.sh Folder MyRootCoordinatorName [DefaultScreenName]
  • Import created files in the Xcode project

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.

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

The generated code is ready to use. The screen provided by ScreenTemplate can by displayed by:

MyFlowCoordinatorBridgePresenter *presenter = [[MyFlowCoordinatorBridgePresenter alloc] initWithSession:session];
[presenter presentFrom:self animated:YES];