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
Conversation
|
@objc(tryThis:) | ||
func tryThis(arguments: Array<Any>?) -> String { | ||
guard let arguments = arguments, let message = arguments.first else { return "No arguments" } | ||
@objc(exampleProp) |
There was a problem hiding this comment.
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)
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Updated. Thanks!
There was a problem hiding this 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?
https://jira.appcelerator.org/browse/TIMOB-26710