Last active
August 29, 2015 14:15
-
-
Save ephemer/b65d379d5a96237d186d to your computer and use it in GitHub Desktop.
Add swift build options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file to be added to the <platform name="ios"> tag of your plugin.xml like this: | |
// <hook type="after_plugin_install" src="hooks/addSwiftOptions.js" /> | |
var fs = require("fs"); | |
module.exports = function (context) { | |
var projectRoot = context.opts.projectRoot; | |
var xcconfigPath = projectRoot + "/platforms/ios/cordova/build.xcconfig"; | |
var pluginDir = context.opts.plugin.dir; | |
var srcDir = pluginDir + "/src/ios/"; | |
var swiftOptions = [""]; // <-- begin to file appending AFTER initial newline | |
swiftOptions.push("IPHONEOS_DEPLOYMENT_TARGET = 7.0"); | |
swiftOptions.push("SWIFT_OBJC_BRIDGING_HEADER = " + srcDir + "Bridging-Header.h"); | |
fs.appendFileSync(xcconfigPath, swiftOptions.join('\n')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment