Generamba is a code generation tool for Xcode projects called Generamba submitted by Egor Tolstoy.
Generamba was created as an alternative to using Xcode templates, and utilizes the liquid template engine. This gives Genaramba a clean syntax similar to Smarty-like templates with support for loops, partials, conditionals, and more.
This example from Egor’s blog shows a comparison between Xcode templates, and using Generamba for code generation.
An Xcode template:
// <strong><em>VARIABLE_viperModuleName______FILENAME</em></strong>
// <strong><em>PROJECTNAME</em></strong>
//
// Created by <strong><em>FULLUSERNAME</em></strong> on <strong><em>DATE</em></strong>
// Copyright <strong><em>YEAR</em></strong> <strong><em>ORGANIZATIONNAME</em></strong>. All rights reserved.
//
#import "___VARIABLE_viperModuleName:identifier___Interactor.h"
#import "___VARIABLE_viperModuleName:identifier___InteractorOutput.h"
@implementation ___VARIABLE_viperModuleName:identifier___Interactor
#pragma mark – ___VARIABLE_viperModuleName:identifier___InteractorInput
@end
The same template coded with Generamba:
// {{ module_info.name }}{{ module_info.file_name }}
// {{ module_info.project_name }}
//
// Created by {{ developer.name }} on {{ date }}.
// Copyright {{ year }} {{ developer.company }}. All rights reserved.
//
#import "{{module_info.name}}Interactor.h"
#import "{{module_info.name}}InteractorOutput.h"
@implementation {{ module_info.name }}Interactor
#pragma mark – {{ module_info.name }}InteractorInput
@end
The features of Generamba include:
– Works with Xcode projects (.xcodeproj) out of the box
– Support for Objective-C and Swift
– Powered by the liquid template engine from Shopify
– Flexible Template management
– Easy integration with Cocoapods
You can read more about Generamba on Egor Tolstoy’s blog.
You can find the Generamba project on Github here.
A nice alternative to using Xcode templates for code generation.
Original article: Xcode Code Generation Tool With A Clean And Readable Syntax Based On Liquid Templates
©2016 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.
Reference source: iOS App Dev Libraries, Controls, Tutorials, Examples and Tools