Skip to content

Instantly share code, notes, and snippets.

@poksi592
Created May 14, 2018 13:42
Show Gist options
  • Save poksi592/138e5c87b2e6cf047fb11f99aba57c85 to your computer and use it in GitHub Desktop.
Save poksi592/138e5c87b2e6cf047fb11f99aba57c85 to your computer and use it in GitHub Desktop.
Module infrastructure
public typealias ModuleParameters = [String: String]
/**
Application module represents a group off all the classes that implement a certain functionality of the module, like:
- Storyboard
- View Controllers
- Views, specific to the module
- Presenters, View Models and other Client architecture classes
- ...
Every module needs to identify itself with unique application route/domain which is queried by `ModuleHub`
*/
protocol ModuleType {
/**
Every module needs to identify itself with a certain route/domain
- returns:
String that represents the route, domain, like _"/module-name"_
*/
var route: String { get }
var paths: [String] { get }
/**
Function has to implement start of the module
- parameters:
- parameters: Simple dictionary of parameters
- path: Path which is later recognised by specific module and converted to possible method
*/
func open(parameters: ModuleParameters?,
path: String?,
callback: ModuleCallback?)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment