Last Updated on : 2024-06-26 10:10:04download
CocoaPods component | Description | Required |
---|---|---|
ThingSmartBizCore | The basic service library that is used to enable a BizBundle and customize certain features. | Yes |
ThingModuleServices | The protocol implemented by a BizBundle module. | Yes |
ThingCommercialLightingXXXBizBundle | A specific BizBundle component. | Optional |
ThingSmartBizCore
and ThingModuleServices
are the basic libraries to integrate with BizBundles.
Enables a BizBundle and customizes certain features.
Theme colors and custom features
Implement the following code block to generate the file thing_custom_config.json
and put it in your project directory:
{
"config": {
"appId": 123,
"thingAppKey": "xxxxxxxxxxxx",
"appScheme": "ThingSmart",
"hotspotPrefixs": ["SmartLife"],
"needBle": true
},
"colors":{
"themeColor": "#FF5A28",
}
}
Parameters
Parameter | Description | Type | Yes | Default value |
---|---|---|---|---|
appId | The app ID. Log in to the Tuya Developer Platform and go to the details page of your app or SDK. In the URL of this page, the ID parameter indicates the value of appId . For example, the value of appId specified by https://platform.tuya.com/oem/app?id=888888 is 888888 . |
Number | Yes | None. |
thingAppKey | The value of AppKey for the SDK that is created on the Tuya Developer Platform. | String | Yes | None. |
appScheme | The value of Channel ID for the SDK that is created on the Tuya Developer Platform. | String | Yes | None. |
hotspotPrefixs | The prefix of a device hotspot for pairing. | Array | No | [“SmartLife”] |
needBle | Specifies whether Bluetooth devices can be paired. | Boolean | No | true |
themeColor | The settings of UI theme colors. | String | No | #FF5A28 |
API description
The basic library of BizBundles provides the methods to access BizBundles and the methods to register the required protocol services. Example:
/**
* Get the instance which implements the special service protocol
* eg:
* id<ThingMallProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingMallProtocol)];
* [impl xxx]; // your staff...
*
* @param serviceProtocol service protocol
* @return instance
*/
- (id)serviceOfProtocol:(Protocol *)service;
/**
* Register an instance for service that cannot be served by BizBundle itself
* Each service can only register one instance or class at a time, whichever is the last
*
* @param service service protocol
* @param instance instance which conforms to the service protocol, strong reference
* unregister if nil
*/
- (void)registerService:(Protocol *)service withInstance:(id)instance;
/**
* Register a class for service that cannot be served by BizBundle itself
* Each service can only register one instance or class at a time, whichever is the last
*
*
* @param service service protocol
* @param cls class which conforms to the service protocol, [cls new] to get instance
* unregister if nil
*/
- (void)registerService:(Protocol *)service withClass:(Class)cls;
/**
* Register route handler for the route that cannot be handled by BizBundle itself
* @param handler block to handle route
* @param url the route url
* @param raw the route raw data
* @return true if the route can be handled, otherwise return false
*/
- (void)registerRouteWithHandler:(BOOL(^)(NSString *url, NSDictionary *raw))handler;
/**
* Update config of biz resource
*
*/
- (void)updateConfig;
After login to the app, the API method - (void)updateConfig
must be called to update cache data. Otherwise, certain BizBundles cannot be used as expected.
Except for the Device Control UI BizBundle, all BizBundles support internal navigation by means of push. Therefore, RootViewController
must be configured in your project.
Provides the protocol implemented by a BizBundle module.
Add the following code block to the Podfile
to add the basic library ThingSmartBizCore
:
source "https://github.com/TuyaInc/TuyaPublicSpecs.git"
source 'https://cdn.cocoapods.org/'
target 'your_target_name' do
# Adds the Commercial Lighting App SDK.
pod "ThingCommercialLightingKit"
# Adds the required BizBundles.
pod "ThingCommercialLightingXXXBizBundle"
end
In the root directory of your project, run pod update
to integrate with a third-party library. For more information about CocoaPods, see CocoaPods Guides.
Customize the settings to initialize a BizBundle:
{
"config": {
"appId": 123,
"thingAppKey": "xxxxxxxxxxxx",
"appScheme": "thingSmart"
},
"colors":{
"themeColor": "#FF5A28",
}
}
Generate the file thing_custom_config.json
and put it in the root directory of your project.
Now, you can get started with your development based on the required BizBundles. For more information about the integration with a specific BizBundle, see its documentation.
The multilingual settings of UI BizBundles follow your project settings. If your project does not support multilingual settings, the target UI BizBundles use English as the default language.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback