Skip to content

Commit

Permalink
Merge pull request #7589 from FokkeZB/TIMOB-19455
Browse files Browse the repository at this point in the history
[TIMOB-19455](5_2_X) Add Swift versions of the applewatch templates
  • Loading branch information
cheekiatng committed Dec 17, 2015
2 parents 39e821f + a72e09b commit 70fc78a
Show file tree
Hide file tree
Showing 86 changed files with 1,618 additions and 349 deletions.
6 changes: 3 additions & 3 deletions cli/lib/creators/applewatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ AppleWatchCreator.prototype.init = function init() {
options: {
'project-dir': this.configOptionProjectDir(130),
'name': this.configOptionAppName(140),
'template': this.configOptionTemplate(160, 'watchos1')
'template': this.configOptionTemplate(160, 'watchos2-swift')
}
};
};
Expand Down Expand Up @@ -218,8 +218,8 @@ AppleWatchCreator.prototype.run = function run(callback) {
extName = this.cli.argv.name,
dest = path.join(projectDir, 'extensions', extName),
isWatchOSv1 = this.cli.argv.template === 'watchos1',
watchkitExtName = extName + (isWatchOSv1 ? ' WatchKit Extension' : ' WatchApp Extension'),
watchkitAppName = extName + (isWatchOSv1 ? ' WatchKit App' : ' WatchApp'),
watchkitExtName = extName + ' WatchKit Extension',
watchkitAppName = extName + ' WatchKit App',
watchkitExtId = this.tiapp.id + (isWatchOSv1 ? '' : '.watchkitapp') + '.watchkitextension',
watchkitAppId = this.tiapp.id + '.watchkitapp';

Expand Down
15 changes: 3 additions & 12 deletions iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -1495,16 +1495,6 @@ iOSBuilder.prototype.validate = function (logger, config, cli) {
this.watchMinOSVersion = targetInfo.watchOS;
}

// check if this target contains any swift code
if (sourcesBuildPhase.length && (!buildSettings.EMBEDDED_CONTENT_CONTAINS_SWIFT || /^NO$/i.test(buildSettings.EMBEDDED_CONTENT_CONTAINS_SWIFT))) {
var files = ext.objs.PBXSourcesBuildPhase[sourcesBuildPhase[0].value].files;
if (files.some(function (f) { return swiftRegExp.test(ext.objs.PBXBuildFile[f.value].fileRef_comment); })) {
// oh no, error
logger.error(__('iOS extension "%s" target "%s" contains Swift code, but "Embedded Content Contains Swift Code" is not enabled.', projectName, targetName) + '\n');
process.exit(1);
}
}

if (targetInfo.isWatchAppV1) {
this.hasWatchAppV1 = true;
} else if (targetInfo.isWatchAppV2orNewer) {
Expand Down Expand Up @@ -1539,12 +1529,13 @@ iOSBuilder.prototype.validate = function (logger, config, cli) {
}

if (plist.WKWatchKitApp) {
if (plist.CFBundleIdentifier.indexOf(appId) !== 0) {
var CFBundleIdentifier = plist.CFBundleIdentifier.replace('$(PRODUCT_BUNDLE_IDENTIFIER)', buildSettings.PRODUCT_BUNDLE_IDENTIFIER);
if (CFBundleIdentifier.indexOf(appId) !== 0) {
logger.error(__('iOS extension "%s" WatchKit App bundle identifier is "%s", but must be prefixed with "%s".', ext.projectName, plist.CFBundleIdentifier, appId) + '\n');
process.exit(1);
}

if (plist.CFBundleIdentifier.toLowerCase() === appId.toLowerCase()) {
if (CFBundleIdentifier.toLowerCase() === appId.toLowerCase()) {
logger.error(__('iOS extension "%s" WatchKit App bundle identifier must be different from the Titanium app\'s id "%s".', ext.projectName, appId) + '\n');
process.exit(1);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
833A9EC71B56F6DB002EEEFB /* InterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 833A9EC61B56F6DB002EEEFB /* InterfaceController.m */; };
833A9ECA1B56F6DB002EEEFB /* NotificationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 833A9EC91B56F6DB002EEEFB /* NotificationController.m */; };
833A9ECD1B56F6DB002EEEFB /* GlanceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 833A9ECC1B56F6DB002EEEFB /* GlanceController.m */; };
833A9ECF1B56F6DB002EEEFB /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 833A9ECE1B56F6DB002EEEFB /* Images.xcassets */; };
833A9ED31B56F6DB002EEEFB /* <%= watchkitAppName %>.app in Resources */ = {isa = PBXBuildFile; fileRef = 833A9ED21B56F6DB002EEEFB /* <%= watchkitAppName %>.app */; };
833A9EDB1B56F6DB002EEEFB /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 833A9ED91B56F6DB002EEEFB /* Interface.storyboard */; };
Expand All @@ -34,8 +33,6 @@
833A9EC61B56F6DB002EEEFB /* InterfaceController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InterfaceController.m; sourceTree = "<group>"; };
833A9EC81B56F6DB002EEEFB /* NotificationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationController.h; sourceTree = "<group>"; };
833A9EC91B56F6DB002EEEFB /* NotificationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationController.m; sourceTree = "<group>"; };
833A9ECB1B56F6DB002EEEFB /* GlanceController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GlanceController.h; sourceTree = "<group>"; };
833A9ECC1B56F6DB002EEEFB /* GlanceController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GlanceController.m; sourceTree = "<group>"; };
833A9ECE1B56F6DB002EEEFB /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
833A9ED21B56F6DB002EEEFB /* <%= watchkitAppName %>.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "<%= watchkitAppName %>.app"; sourceTree = BUILT_PRODUCTS_DIR; };
833A9ED81B56F6DB002EEEFB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -79,8 +76,6 @@
833A9EC61B56F6DB002EEEFB /* InterfaceController.m */,
833A9EC81B56F6DB002EEEFB /* NotificationController.h */,
833A9EC91B56F6DB002EEEFB /* NotificationController.m */,
833A9ECB1B56F6DB002EEEFB /* GlanceController.h */,
833A9ECC1B56F6DB002EEEFB /* GlanceController.m */,
833A9ECE1B56F6DB002EEEFB /* Images.xcassets */,
833A9EC21B56F6DB002EEEFB /* Supporting Files */,
);
Expand Down Expand Up @@ -169,7 +164,7 @@
};
};
};
buildConfigurationList = 833A9E8E1B56F6D1002EEEFB /* Build configuration list for PBXProject "TemplateApp" */;
buildConfigurationList = 833A9E8E1B56F6D1002EEEFB /* Build configuration list for PBXProject "<%= extName %>" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
Expand Down Expand Up @@ -216,7 +211,6 @@
files = (
833A9ECA1B56F6DB002EEEFB /* NotificationController.m in Sources */,
833A9EC71B56F6DB002EEEFB /* InterfaceController.m in Sources */,
833A9ECD1B56F6DB002EEEFB /* GlanceController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -332,9 +326,10 @@
"DEBUG=1",
"$(inherited)",
);
IBSC_MODULE = TemplateApp64_WatchKit_Extension;
IBSC_MODULE = <%= watchkitExtName.replace(/ /g, '_') %>;
INFOPLIST_FILE = "<%= watchkitAppName %>/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
PRODUCT_BUNDLE_IDENTIFIER = <%= watchkitExtId %>;
PRODUCT_NAME = "<%= watchkitAppName %>";
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4;
Expand All @@ -346,9 +341,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
IBSC_MODULE = TemplateApp64_WatchKit_Extension;
IBSC_MODULE = <%= watchkitExtName.replace(/ /g, '_') %>;
INFOPLIST_FILE = "<%= watchkitAppName %>/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
PRODUCT_BUNDLE_IDENTIFIER = <%= watchkitExtId %>;
PRODUCT_NAME = "<%= watchkitAppName %>";
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4;
Expand All @@ -365,6 +361,7 @@
);
INFOPLIST_FILE = "<%= watchkitExtName %>/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = <%= watchkitAppId %>;
PRODUCT_NAME = "<%= watchkitExtName %>";
SKIP_INSTALL = YES;
};
Expand All @@ -375,6 +372,7 @@
buildSettings = {
INFOPLIST_FILE = "<%= watchkitExtName %>/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = <%= watchkitAppId %>;
PRODUCT_NAME = "<%= watchkitExtName %>";
SKIP_INSTALL = YES;
};
Expand All @@ -383,7 +381,7 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
833A9E8E1B56F6D1002EEEFB /* Build configuration list for PBXProject "TemplateApp" */ = {
833A9E8E1B56F6D1002EEEFB /* Build configuration list for PBXProject "<%= extName %>" */ = {
isa = XCConfigurationList;
buildConfigurations = (
833A9EB41B56F6D1002EEEFB /* Debug */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@
</objects>
<point key="canvasLocation" x="235" y="347"/>
</scene>
<!--Glance Interface Controller-->
<scene sceneID="BOz-TT-tkC">
<objects>
<glanceController spacing="0.0" id="0uZ-2p-rRc" customClass="GlanceController" customModuleProvider="">
<items>
<group alignment="left" id="t8f-Gd-c4y"/>
<group alignment="left" id="uCw-4Q-Ouw"/>
</items>
<edgeInsets key="margins" left="0.0" right="0.0" top="0.0" bottom="14"/>
</glanceController>
</objects>
<point key="canvasLocation" x="235" y="672"/>
</scene>
<!--Static Notification Interface Controller-->
<scene sceneID="AEw-b0-oYE">
<objects>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string><%= watchkitAppId %></string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string><%= extName %></string>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down

0 comments on commit 70fc78a

Please sign in to comment.