Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iOS): swift module’s app.js template made correct (8_0_X) #10699

Merged
merged 3 commits into from Feb 14, 2019

Conversation

vijaysingh-axway
Copy link
Contributor

@vijaysingh-axway vijaysingh-axway added this to the 8.0.0 milestone Feb 13, 2019
@vijaysingh-axway vijaysingh-axway changed the title ios(fix) : swift module’s app.js template made correct fix(iOS) : swift module’s app.js template made correct Feb 13, 2019
@build
Copy link
Contributor

build commented Feb 13, 2019

Messages
📖

💾 Here's the generated SDK zipfile.

📖

✅ All tests are passing
Nice one! All 2990 tests are passing.

Generated by 🚫 dangerJS against 6709941

@objc(tryThis:)
func tryThis(arguments: Array<Any>?) -> String {
guard let arguments = arguments, let message = arguments.first else { return "No arguments" }
@objc(exampleProp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a great place to demonstrate Swift property getter/setter instead of the ObjC style methods:

@objc public var exampleProp: String {
    get { 
        // Example property getter
        return "Titanium rocks!"
    }
    set {
        // Example property setter
        // Call with "MyModule.exampleProp = 'newValue'"
        self.replaceValue(newValue, forKey: "exampleProp", notification: false)
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Updated. Thanks!

@janvennemann janvennemann changed the title fix(iOS) : swift module’s app.js template made correct fix(iOS): swift module’s app.js template made correct (8_0_X) Feb 13, 2019
@ssjsamir ssjsamir self-requested a review February 14, 2019 12:00
Copy link
Contributor

@ssjsamir ssjsamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FR Passed The example in the swift module now works by default.

example.js

// This is a test harness for your module
// You should do something interesting in this harness
// to test out the module and to provide instructions
// to users on how to use it by example.


// open a single window
var win = Ti.UI.createWindow({
	backgroundColor:'white'
});
var label = Ti.UI.createLabel();
win.add(label);
win.open();

// TODO: write your module tests here
var test = require('com.example.tese');
Ti.API.info("module is => " + test);

label.text = test.example();

Ti.API.info("module exampleProp is => " + test.exampleProp);
test.exampleProp = "This is a test value";

if (Ti.Platform.name == "android") {
	var proxy = test.createExample({
		message: "Creating an example Proxy",
		backgroundColor: "red",
		width: 100,
		height: 100,
		top: 100,
		left: 150
	});

	proxy.printMessage("Hello world!");
	proxy.message = "Hi world!.  It's me again.";
	proxy.printMessage("Hello world!");
	win.add(proxy);
}

Test Environment

iPhone 6 Sim (12.1)
APPC CLI: 7.0.10-14
Operating System Name: Mac OS Mojave
Operating System Version: 10.14.2
Node.js Version: 8.9.1
Xcode 10.1

Awaiting CR Has this been approved to go in to 8_0_X?

@ssjsamir ssjsamir merged commit a963cba into tidev:8_0_X Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants