<|start_filename|>KillBug/Classes/Core/NSObject+KBSwizzle.h<|end_filename|>
//
//  NSObject+KBSwizzle.h
//  KillBug
//
//  Created by 2020 on 2021/3/29.
//
#pragma mark - NSObject 类的方法交换

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSObject (KBSwizzle)
+ (BOOL)kb_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError **)error_;
+ (BOOL)kb_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError **)error_;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>KillBug/Classes/UI/UIView+KBAutoTrack.h<|end_filename|>
//
//  UIView+KBAutoTrack.h
//  KillBug
//
//  Created by 2020 on 2021/3/30.
//

#pragma mark - touch方法 交换

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (KBAutoTrack)
+ (void)kb_autoTrack;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>KillBug/Classes/Core/KBTrackConfig.h<|end_filename|>
//
//  KBTrackConfig.h
//  KillBug
//
//  Created by 2020 on 2021/3/29.
//

#pragma mark - Track 配置

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface KBTrackConfig : NSObject
/**
 自动采集默认需要过滤的控制器列表
 */
@property(copy,nonatomic) NSArray* controllers;

+ (NSArray*)controllers;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>KillBug/Classes/UI/UIViewController+KBAutoTrack.h<|end_filename|>
//
//  UIViewController+KBAutoTrack.h
//  KillBug
//
//  Created by 2020 on 2021/3/29.
//

#pragma mark - viewWillAppear 交换

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIViewController (KBAutoTrack)
- (void)kb_autotrack_viewWillAppear:(BOOL)animated;
@end

NS_ASSUME_NONNULL_END


<|start_filename|>Example/KillBug/UIAppDelegate.h<|end_filename|>
//
//  KBAppDelegate.h
//  KillBug
//
//  Created by tliens on 03/29/2021.
//  Copyright (c) 2021 tliens. All rights reserved.
//

@import UIKit;

@interface UIAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end


<|start_filename|>KillBug/Classes/Core/KBUIApplicationEvents.h<|end_filename|>
//
//  KBUIApplicationEvents.h
//  KillBug
//
//  Created by 2020 on 2021/3/29.
//

#pragma mark - app 生命周期

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface KBUIApplicationEvents : NSObject

@end

NS_ASSUME_NONNULL_END


<|start_filename|>KillBug/Classes/Core/KBSwizzler.h<|end_filename|>
//
//  KBSwizzler.h
//  KillBug
//
//  Created by 2020 on 2021/3/29.
//

#pragma mark - 方法交换器

#import <Foundation/Foundation.h>
/// 消除警告
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
typedef void (^swizzleBlock)();
#pragma clang diagnostic pop

NS_ASSUME_NONNULL_BEGIN

@interface KBSwizzler : NSObject
+ (void)swizzleSelector:(SEL)aSelector onClass:(Class)aClass withBlock:(swizzleBlock)block named:(NSString *)aName;
+ (void)unswizzleSelector:(SEL)aSelector onClass:(Class)aClass named:(NSString *)aName;
@end

NS_ASSUME_NONNULL_END


<|start_filename|>KillBug/Classes/UI/UIApplication+KBAutoTrack.h<|end_filename|>
//
//  UIApplication+KBAutoTrack.h
//  KillBug
//
//  Created by 2020 on 2021/3/29.
//

#pragma mark - action 交换

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIApplication (KBAutoTrack)
- (BOOL)kb_sendAction:(SEL)action
                   to:(nullable id)to
                 from:(nullable id)from
             forEvent:(nullable UIEvent *)event;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>Example/KillBug/KBViewController.h<|end_filename|>
//
//  KBViewController.h
//  KillBug
//
//  Created by tliens on 03/29/2021.
//  Copyright (c) 2021 tliens. All rights reserved.
//

@import UIKit;

@interface KBViewController : UIViewController

@end


<|start_filename|>KillBug/Classes/Manager/KBAutoTrackManager.h<|end_filename|>
//
//  KBAutoTrackManager.h
//  KillBug
//
//  Created by 2020 on 2021/3/29.
//

#pragma mark - 自动跟踪管理

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef void (^DebugInfoHandler)(NSString *info);

@interface KBAutoTrackManager : NSObject

@property(nonatomic,strong)DebugInfoHandler infoHandler;

///单例
+ (instancetype)shared;

/// 普通 UIControl
- (void)trackEventView:(UIView *)view;

/// tableview&collectionview
- (void)trackEventView:(UIView *)view withIndexPath:(nullable NSIndexPath *)indexPath;

/// viewWillAppear
- (void)trackViewWillAppear:(UIViewController *)controller;

/// uiapplication 活跃状态
- (void)trackApplication:(NSString *)state;

/// uiapplication 死亡信息
- (void)trackApplicationDeadReason:(NSString *)reason;

/// 用户的touch事件
- (void)trackTouch:(NSString *)info;

/// 日志回调
- (void)debugInfoHandler:(DebugInfoHandler)handler;

@end

NS_ASSUME_NONNULL_END
