Skip to main content
Version: 7.3.0

Create UI Extension

Smartface Native Framework is extendible and you can make your own creative components by using core elements. In this section you can find some extensions developed by Smartface Team.

Also in the examples below you can see how easy it is to create an UI extension. After creating UI extension you can use it like any other sf-core ui module.

Native Switch Example for both Platforms

import System from "@smartface/native/device/system";
import View from "@smartface/native/ui/view";

export default class SwitchIOS extends View {
constructor(params?: any) {
if (System.OS === System.OSType.IOS) {
const NativeSwitch = SF.requireClass("UISwitch");
const SwitchController = SF.defineClass("SwitchController : NSObject", {
switchAction: function () {
if (typeof this.onToggle === "function") {, this);
const controllerInstance =;
this.nativeObject =;
1 << 12
// Assign parameters given in constructor
if (params) {
for (const param in params) {
this[param] = params[param];
get toggle(): boolean {
return this.nativeObject.isOn;
set toggle(toggle: boolean) {
this.nativeObject.setOnAnimated(toggle, true);

Alternatively, you can merge both files into a single one, just like any component from Smartface itself!