Type Function
Object NativeDisplayObject
Library native.*
Return value none
Revision Release 2020.3619
Keywords native object, property accessors
See also object:getNativeProperty()


This function allows you to set properties of the underlying native object created by the native library. For example, if you create a WebView on iOS, you can set the Obj-C properties of the corresponding WKWebView (or WKWebViewConfiguration if called before a request is made).


This is an iOS-only feature.


object:setNativeProperty( property, value )
property (required)

String. The string name for the native property.

value (required)

The value to set the property to. Must be a Lua value compatible with Obj-C. The following Lua values are converted to the corresponding values in Obj-C: boolean, string, array, table, and number.


local webView = native.newWebView( 0, 0, display.contentWidth, display.contentHeight )
webView:setNativeProperty( "allowsInlineMediaPlayback", true )