Switch Control Panel

Last Updated on : 2024-06-05 09:59:33download

The switch control panel library ThingSmartSwitchPanelKit 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 ThingSmartHomeKit 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 'ThingSmartSwitchPanelKit'
    
  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];
    
        ThingSmartDeviceModel *deviceModel = self.home.deviceList[indexPath.row];
        ThingSmartSwitchManager *manager = [[ThingSmartSwitchManager alloc] initWithDeviceId:deviceModel.devId];
        [self.navigationController pushViewController:manager.viewController animated:YES];
    }