Skip to content

Commit

Permalink
feat: update Swift module template to Swift 5 (8_1_X) (#10977)
Browse files Browse the repository at this point in the history
* feat: update Swift module template to Swift 5

* fix linting issues
  • Loading branch information
janvennemann authored and keerthi1032 committed Jul 1, 2019
1 parent 7305765 commit ea6ad0e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion iphone/TitaniumKit/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jazzy \
--author_url https://appcelerator.com \
--github_url https://github.com/appcelerator/titanium_mobile \
--github-file-prefix https://github.com/appcelerator/titanium_mobile/tree/next \
--module-version 8.0.0 \
--module-version 8.1.0 \
--sdk iphonesimulator \
--umbrella-header TitaniumKit/TitaniumKitDocs.h \
--framework-root . \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
* Hook that makes sure the Titanium Xcode file templates get installed.
*
* @copyright
* Copyright (c) 2014-present by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2018-present by Appcelerator, Inc. All Rights Reserved.
*
* @license
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
'use strict';

var path = require('path');
var fs = require('fs-extra');

exports.cliVersion = '>=3.2';

exports.init = function (logger, config, cli, appc) {
cli.on('create.post.module', function (creator) {
cli.on('create.post.module', function () {
var __ = appc.i18n(__dirname).__;

logger.info(__('Installing Titanium Xcode templates (Swift), if needed'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import TitaniumKit
@objc(<%- moduleIdAsIdentifier %>ExampleProxy)
class <%- moduleIdAsIdentifier %>ExampleProxy: TiProxy {

override func _init(withPageContext context: TiEvaluator!) -> <%- moduleIdAsIdentifier %>ExampleProxy! {
override func _init(withPageContext context: TiEvaluator!) -> Self? {
super._init(withPageContext: context)

// Custom proxy init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ class <%- moduleIdAsIdentifier %>Module: TiModule {
}

@objc(example:)
func example(arguments: Array<Any>?) -> String {
func example(arguments: Array<Any>?) -> String? {
guard let arguments = arguments, let params = arguments[0] as? [String: Any] else { return nil }

// Example method.
// Call with "MyModule.example(args)"
// Call with "MyModule.example({ hello: 'world' })"

return "hello world!"
return params["hello"] as? String
}

@objc public var exampleProp: String {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Ti.SwiftSupport
* Copyright (c) 2018-present by Axway Appcelerator
* Copyright (c) 2018-present by Axway Appcelerator.
* All Rights Reserved.
*/

Expand All @@ -12,13 +12,18 @@ exports.init = init;

/**
* Main entry point for our plugin which looks for the platform specific
* plugin to invoke
* plugin to invoke.
*
* @param {Object} logger The logger instance.
* @param {Object} config The hook config.
* @param {Object}cli The Titanium CLI instance.
* @param {Object} appc The Appcelerator CLI instance.
*/
function init(logger, config, cli, appc) {
cli.on('build.ios.xcodeproject', {
pre: function(data) {
pre: function (data) {
var xobjs = data.args[0].hash.project.objects;

Object.keys(xobjs.PBXNativeTarget).forEach(function (targetUuid) {
var target = xobjs.PBXNativeTarget[targetUuid];
if (target && typeof target === 'object') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
DB52E2211E9CCD7000AAAEE0 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
LastUpgradeCheck = 1020;
TargetAttributes = {
DB52E2291E9CCD7000AAAEE0 = {
CreatedOnToolsVersion = 8.3;
Expand All @@ -159,10 +159,11 @@
};
buildConfigurationList = DB52E2241E9CCD7000AAAEE0 /* Build configuration list for PBXProject "<%- moduleIdAsIdentifier %>" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = DB52E2201E9CCD7000AAAEE0;
productRefGroup = DB52E22B1E9CCD7000AAAEE0 /* Products */;
Expand Down Expand Up @@ -228,15 +229,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -286,15 +295,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -364,7 +381,7 @@
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "$(SRCROOT)/Titanium";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
VALID_ARCHS = "$(ARCHS_STANDARD)";
};
name = Debug;
Expand Down Expand Up @@ -402,7 +419,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "$(SRCROOT)/Titanium";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
VALID_ARCHS = "$(ARCHS_STANDARD)";
};
name = Release;
Expand Down

0 comments on commit ea6ad0e

Please sign in to comment.