static createPlatform()

in lib/Api.js [119:141]


    static createPlatform (destination, config, options, events) {
        setupEvents(events);

        // CB-6992 it is necessary to normalize characters
        // because node and shell scripts handles unicode symbols differently
        // We need to normalize the name to NFD form since iOS uses NFD unicode form
        const name = config.name().normalize('NFD');
        let result;
        try {
            result = require('./create')
                .createProject(destination, config.getAttribute('ios-CFBundleIdentifier') || config.packageName(), name, options, config)
                .then(() => {
                    // after platform is created we return Api instance based on new Api.js location
                    // This is required to correctly resolve paths in the future api calls
                    const PlatformApi = require(path.resolve(destination, 'cordova/Api'));
                    return new PlatformApi('ios', destination, events);
                });
        } catch (e) {
            events.emit('error', 'createPlatform is not callable from the iOS project API.');
            throw e;
        }
        return result;
    }