Tuya Smart Sweeper iOS SDK is based on the Tuya Smart Home iOS SDK (Home SDK) and expands the interface package that enables the required functions of a sweeper device. This allows you to simplify the development process. The following functions are supported:
- Streaming media (for gyro or visual sweepers) universal data channel
- Data transmission channel of laser sweeper
- Laser sweeper real-time or historical sweep record
- Sweeper universal voice download service
The laser sweeper data is divided into real-time data and historical data. Both types of data include map data and path data and are stored in files in the cloud. The map and path of real-time data are stored in different files, and the map and path of historical data are stored in the same file. The map and path data are split and read based on the specified rules.
Tuya Smart Sweeper iOS SDK is used in the development based on the Tuya Smart Home iOS SDK. Before you begin the development with the SDK, you must register a developer account, create a product, and then complete other required steps on the Tuya Smart Development Platform. This allows you to obtain a key to activate the SDK. For more information, see Preparation.
Add the following content to the file Podfile
:
platform :ios, '9.0'
target 'your_target_name' do
pod 'TuyaSmartSweeperKit'
end
Execute the command pod update
in the root directory of the project to integrate the SDK.
For more information about CocoaPods, see CocoaPods Guides.
-
Open the project to apply the setting,
Target => General
, and setBundle Identifier
to the value from the Tuya developer center. -
Import a security image to the project, rename the image as
t_s.bmp
from Preparation, and then add the image toProject Setting => Target => Build Phases => Copy Bundle Resources
. -
Add the following content to the project file
PrefixHeader.pch
:
#import <TuyaSmartSweeperKit/TuyaSmartSweeperKit.h>
For a Swift project, add the following content to the xxx_Bridging-Header.h
file:
#import <TuyaSmartSweeperKit/TuyaSmartSweeperKit.h>
- Open the file
AppDelegate.m
,and use theApp Key
andApp Secret
that are obtained from the development platform in the[AppDelegate application:didFinishLaunchingWithOptions:]
method to initialize SDK:
Objc:
[[TuyaSmartSDK sharedInstance] startWithAppKey:<#your_app_key#> secretKey:<#your_secret_key#>];
Swift:
TuyaSmartSDK.sharedInstance()?.start(withAppKey: <#your_app_key#>, secretKey: <#your_secret_key#>)
All the preparation steps are finished. You can use the SDK to develop your application.
For more information, see Tuya Smart Sweeper SDK - iOS.