Hacker News new | ask | show | jobs
by kartickv 3421 days ago
The NativeScript site says that I can use their cross-platform wrappers like Button, which delegates to UIButton on iOS and android.whatever.Button on Android. So far, so good. But suppose I now want to invoke some method on Button that exists only on iOS. Can I do that? If not, it's the least-common-denominator, which I'm not interested in using to build an app. I'm thinking about something like:

var button = new Button(...);

// Set the common properties:

button.backgroundColor = ...;

button.text = ...;

if (iOS) {

  // Set iOS-specific properties
} else {

  // Set Android-specific properties

}
1 comments

Yes, it literally works like that. See the docs: http://docs.nativescript.org/cookbook/application

The variable is app.ios / app.android