HyperioniOSExtension
在使用前,请注意以下几点
HYPEnvironmentSelector
Cocoapods 导入
在 Podfile
中
pod 'HyperioniOSExtension/EnvironmentSelector', :configurations => ['Debug'] # Not Depend HyperioniOS, iOS Version >= 7.0
or
pod 'HyperioniOSExtension/EnvironmentSelector-Plugin', :configurations => ['Debug'] # Depend HyperioniOS, iOS Version >= 9.0
使用
// If Use Not Depend HyperioniOS Version, Following `HYPEnvironmentSelectorPlugin.manager` change to `[HYPEnvironmentSelectorManager sharedManager]`
// Set the environment variable of the environment selection page.
// The element of `environmentItems` must conform to the `HYPEnvironmentItemProtocol` protocol.
HYPEnvironmentSelectorPlugin.manager.environmentItems = @[envItem1, envItem2, envItem3];
// Actively fill in the template for the environment variable
HYPEnvironmentSelectorPlugin.manager.customEnvironmentItemTemplate = envItem1;
// Set callback after selecting environment
HYPEnvironmentSelectorPlugin.manager.environmentSelectedBlock = ^(NSObject<HYPEnvironmentItemProtocol> * _Nullable obj) {
// Click on the environment setting and return the corresponding obj.
};
// Whether to show in the column to the right of `HyperioniOS`
HYPEnvironmentSelectorPlugin.manager.isShowInSidebarList = YES/NO;
// Whether to allow editing with the element of `environmentItems` as a template
HYPEnvironmentSelectorPlugin.manager.isCanEditItemFromListItem = YES/NO;
// Actively pop up the environment selection page
[HYPEnvironmentSelectorPlugin.manager showEnvironmentSelectorWindowAnimated:YES isCanCancel:YES completionBlock:^{
// Callback after popup
}];
// Actively hide the environment selection page
[HYPEnvironmentSelectorPlugin.manager hideEnvironmentSelectorWindowAnimated:YES completionBlock:^{
// The callback after the hide
}];
HYPEnvironmentItemProtocol 对象注解
ObjC
对象定义注解
- 必须遵循
HYPEnvironmentItemProtocol
协议 - 必须包含
name
属性
@interface MyEnvItem : NSObject <HYPEnvironmentItemProtocol>
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *otherVariable;
@end
@implementation MyEnvItem
@end
Swift
对象定义注解
- 必须从
NSObject
继承,符合HYPEnvironmentItemProtocol
协议 - 当类定义需要动态属性时(
Swift 4+
定义加上@objcMembers
) - 必须包含
var name: String?
变量 - 必须实现
required override init() { super.init() }
方法 - 使用变量
var
对于所有属性。不要使用常量let
- 所有属性类型都是
String?
(Optional
)
@objcMembers
class MyEnvItem: NSObject, HYPEnvironmentItemProtocol {
var name: String?
var otherVariable: String?
required override init() {
super.init()
}
}
HYPFPSMonitor
Cocoapods 导入
在 Podfile
中
pod 'HyperioniOSExtension/FPSMonitor', :configurations => ['Debug'] # Not Depend HyperioniOS, iOS Version >= 6.0
or
pod 'HyperioniOSExtension/FPSMonitor-Plugin', :configurations => ['Debug'] # Depend HyperioniOS, iOS Version >= 9.0
使用
// If Use Not Depend HyperioniOS Version, Following `HYPFPSMonitorPlugin.manager` change to `[HYPFPSMonitorManager sharedManager]`
// Set whether touch/drag FPS monitoring View is allowed
HYPFPSMonitorPlugin.manager.isCanTouchFPSView = YES/NO;
// Actively display FPS monitoring View
[HYPFPSMonitorPlugin.manager showFPSMonitor];
// Actively hide FPS monitoring View
[HYPFPSMonitorPlugin.manager hideFPSMonitor];
HYPUIMainThreadChecker
Cocoapods 导入
在 Podfile
中
pod 'HyperioniOSExtension/HYPUIMainThreadChecker', :configurations => ['Debug'] # Not Depend HyperioniOS, iOS Version >= 5.0
or
pod 'HyperioniOSExtension/HYPUIMainThreadChecker-Plugin', :configurations => ['Debug'] # Depend HyperioniOS, iOS Version >= 9.0
使用
// If Use Not Depend HyperioniOS Version, Following `HYPUIMainThreadCheckerPlugin.manager` change to `[HYPUIMainThreadCheckerManager sharedManager]`
// Turns on UI operation main thread (main_queue) monitoring
[HYPUIMainThreadCheckerPlugin.manager open];
// Turns off UI operation main thread (main_queue) monitoring
[HYPUIMainThreadCheckerPlugin.manager close];