Switch Control Panel

Last Updated on : 2022-03-03 07:25:30download

The switch control panel library TuyaSmartSwitchPanelKit provides APIs for apps on iOS 9.0 or later. Control panels for switches are developed based on native code and support all switch categories.

Advantages

  • Lightweight and free of frameworks such as React Native.

  • Support all switch categories and apply to new products without app launching.

  • Facilitate debugging during development.

    Switch Control Panel Switch Control Panel Switch Control Panel

Get started

If the SDK TuyaSmartHomeKit has been integrated into your project, perform the following steps to configure and use the panel library:

  1. Add the following line to the Podfile.

    pod 'TuyaSmartSwitchPanelKit'
    
  2. Add the following code block to the home page where devices are listed.

    Objective-C:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
    	[tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    	TuyaSmartDeviceModel *deviceModel = self.home.deviceList[indexPath.row];
    	TuyaSmartSwitchManager *manager = [[TuyaSmartSwitchManager alloc] initWithDeviceId:deviceModel.devId];
    	[self.navigationController pushViewController:manager.viewController animated:YES];
    }