Skip to content

Instantly share code, notes, and snippets.

@janvennemann
Created May 28, 2019 11:20
Show Gist options
  • Save janvennemann/c97c731a67dfd03dbafa22824ee1feda to your computer and use it in GitHub Desktop.
Save janvennemann/c97c731a67dfd03dbafa22824ee1feda to your computer and use it in GitHub Desktop.
Titanium module hook to add Storyboards
const fs = require('fs');
const path = require('path');
exports.id = 'my.module.add.storyboard';
exports.cliVersion = '>=3.2';
exports.init = init;
function init(logger, config, cli) {
cli.on('build.ios.xcodeproject', {
pre: (data, next) => {
const builder = data.ctx;
const xcodeProject = data.args[0];
const originalGenerateUuid = xcodeProject.generateUuid;
xcodeProject.generateUuid = builder.generateXcodeUuid.bind(builder, xcodeProject);
// Edit the name to match your .storyboard
xcodeProject.addResourceFile(path.join(builder.buildDir, 'Storyboard.storyboard'));
xcodeProject.generateUuid = originalGenerateUuid;
next();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment