Ruby gem to generate a clean iOS architecture based on a spec file written in json format. Having the following components, the gem will generate files according and it will add some logic in order to save development time.
In the roadmap there are features like estimations and creation of tickets in Github Issues and others management tools.
gem install iosgen
$ iosgen generate spec.json -t
spec/ios_gen/generator/spec.json
[+] Created Source File: FJBNotificationsViewController.h
[+] Created Source File: FJBNotificationsViewController.m
[+] Created Source File: FJBNotificationsViewModelProtocol.h
[+] Created Source File: FJBNotificationsViewModel.h
[+] Created Source File: FJBNotificationsViewModel.m
[+] Created Source File: FJBNotificationsApiInteractorProtocol.h
[+] Created Source File: FJBNotificationsApiInteractor.h
[+] Created Source File: FJBNotificationsApiInteractor.m
[+] Created Test File: FJBNotificationsViewModelTests.m
[+] Created Test File: FJBNotificationsApiInteractorTests.m
- Add
-t
to generate XCTest files
The property object is composited of two strings, type and name, which repesent variables.
- type : Any Object type
- name : name of the object
{
"type": "NSIndexPath *",
"name": "selectedIndexPath"
}
{
"description": "Dismiss the ViewController when the button is tapped",
"return_type": "void",
"name": "didTapOnCloseButton:",
"arguments": [{
"type" : "UIButton *",
"name" : "closeButton"
}]
}
Interactor is an object which perform actions for other components. In this example the ViewModel needs to comunicate to the server which notification has been mark as read.
{
"description" : "Api Interactions required by Notification ViewModel",
"name": "FJBNotificationsApiInteractor",
"properties": [],
"actions": [
{
"description": "Perform API request to mark a notification as read",
"return_type": "void",
"name": "markNotificationAsRead:onCompletionBlock:",
"arguments": [
{
"type": "NSString *",
"name": "notificationId"
},
{
"type": "void(^)()",
"name": "completionBlock"
}
]
}
]
}
{
"description" : "State of NotificationViewController and perform bussiness logic",
"name": "FJBNotificationsViewModel",
"properties": [],
"actions": [],
"interactors": []
}
"view_controller": {
"description": "ViewController to show the list of notifications",
"name": "FJBNotificationsViewController"
}
{
"view_controller": {
"description": "ViewController to show the list of notifications",
"name": "FJBNotificationViewController",
"view_model": {
"description" : "State of NotificationViewController and perform bussiness logic",
"name": "FJBNotificationsViewModel",
"properties": [
{
"type": "NSIndexPath *",
"name": "selectedIndexPath"
}
],
"actions": [
{
"description": "Dismiss the ViewController when the button is tapped",
"return_type": "void",
"name": "didTapOnCloseButton"
},
{
"description": "Mark notification as read when the notification is selected",
"return_type": "void",
"name": "didTapAtIndexPath:",
"arguments": [
{
"type": "NSIndexPath *",
"name": "indexPath"
}
]
}
],
"interactors": [
{
"description" : "Api Interactions required by Notification ViewModel",
"name": "FJBNotificationsApiInteractor",
"properties": [],
"actions": [
{
"description": "Perform API request to mark a notification as read",
"return_type": "void",
"name": "markNotificationAsRead:onCompletionBlock:",
"arguments": [
{
"type": "NSString *",
"name": "notificationId"
},
{
"type": "^()",
"name": "completionBlock"
}
]
}
]
}
]
}
}
}