Convenient debugging button.

Overview

FunnyButton

Example

在平时开发,运行期间有时候想中途看一下某个视图或变量的信息,虽说打断点是可以查看,但有时候断点调试有时候会卡住好一会才能看到(尤其是大项目经常卡很久),极度影响效率。

基于这种情况,FunnyButton就是为了能够便捷调试的全局按钮,添加好点击事件,就能随时点击查看某个视图或变量的信息,又可以直接调试某些函数。

Feature:
    ✅ 位于Window层级,不会被app内的界面覆盖;
    ✅ 自适应安全区域,自动靠边,适配横竖屏;
    ✅ 可执行单个/多个点击事件;
    ✅ 兼容Objective-C环境调试;
    ✅ 仅限DEBUG环境;
    ✅ API简单易用。

Basic use

为了兼容OC,基于NSObject的扩展提供给所有基类设置点击事件的接口,以UIViewController为例:

  • Swift
// 建议初始化好页面时设置
override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    // 设置点击事件
    replaceFunnyAction {
        // 注意内存泄漏:闭包内部用到`self`记得使用`[weak self]`
        print("点我干森莫")
    }
}

// 建议页面即将消失时移除这些事件
override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    // 移除点击事件
    removeFunnyActions()
}
  • Objective-C
// 建议初始化好页面时设置
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    // 设置点击事件
    [self replaceFunnyActionWithWork:^{
        // 注意内存泄漏:闭包内部用到`self`记得使用`__weak`
        NSLog(@"点我干森莫");
    }];
}

// 建议页面即将消失时移除这些事件
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    // 移除点击事件
    [self removeFunnyActions];
}

API

FunnyButton.API.swift - 公开可使用接口。

  • replace action - 替换、覆盖全部事件
/// 替换单个`Action`
@objc func replaceFunnyAction(work: @escaping () -> ()) { ... }

/// 替换多个`Action`
@objc func replaceFunnyActions(_ actions: [FunnyAction]) { ... }
  • add action - 在已有的事件上添加新的事件
/// 添加单个`Action`
@objc func addFunnyAction(name: String? = nil, work: @escaping () -> ()) { ... }

/// 添加多个`Action`
@objc func addFunnyActions(_ actions: [FunnyAction]) { ... }
  • remove action - 删除目标/全部事件
/// 带条件移除目标`Action`(`decide`返回`true`则删除)
@objc func removeFunnyActions(where decide: (FunnyAction) -> Bool) { ... }

/// 移除所有`Action`
@objc func removeFunnyActions() { ... }
  • update layout - 刷新布局
/// 刷新`FunnyButton`布局
@objc func updateFunnyLayout() { ... }

Custom button UI

FunnyButton.swift - 可改动的UI属性均为静态属性,且有默认实现,如需改动建议启动App时配置。

public class FunnyButton: UIButton {
    ......
    
    /// 普通状态
    static var normalEmoji = "😛"
    
    /// 点击状态
    static var touchingEmoji = "😝"
    
    /// 毛玻璃样式(nil为无毛玻璃)
    static var effect: UIVisualEffect? = {
        if #available(iOS 13, *) {
            return UIBlurEffect(style: .systemThinMaterial)
        }
        return UIBlurEffect(style: .prominent)
    }()
    
    /// 背景色
    static var bgColor: UIColor? = UIColor(red: 200.0 / 255.0, green: 100.0 / 255.0, blue: 100.0 / 255.0, alpha: 0.2)
    
    /// 初始点(想`靠右/靠下`的话,`x/y`的值就设置大一点,最后会靠在安全区域的边上)
    static var startPoint: CGPoint = CGPoint(x: 600, y: 100)
    
    /// 安全区域的边距
    static var safeMargin: CGFloat = 12
    
    ......
}

// Initialization Example:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    ......
    
    FunnyButton.normalEmoji = "🦖"
    FunnyButton.touchingEmoji = "🐲"

    return true
}

Installation

FunnyButton is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'FunnyButton'

Author

Rogue24, [email protected]

License

FunnyButton is available under the MIT license. See the LICENSE file for more info.

You might also like...
Profiling / Debugging assist tools for iOS. (Memory Leak, OOM, ANR, Hard Stalling, Network, OpenGL, Time Profile ...)
Profiling / Debugging assist tools for iOS. (Memory Leak, OOM, ANR, Hard Stalling, Network, OpenGL, Time Profile ...)

MTHawkeye Readme 中文版本 MTHawkeye is profiling, debugging tools for iOS used in Meitu. It's designed to help iOS developers improve development producti

Free macOS app for iOS view debugging.
Free macOS app for iOS view debugging.

Introduction You can inspect and modify views in iOS app via Lookin, just like UI Inspector in Xcode, or another app called Reveal. Official Website:h

Network debugging made easy,This network debugging tool is developed based on the swift version of Wormholy.
Network debugging made easy,This network debugging tool is developed based on the swift version of Wormholy.

Start debugging iOS network calls like a wizard, without extra code! Wormholy makes debugging quick and reliable. What you can do: No code to write an

Customizable download button with progress and transition animations. It is based on Apple's App Store download button.
Customizable download button with progress and transition animations. It is based on Apple's App Store download button.

AHDownloadButton is a customizable download button similar to the download button in the latest version of Apple's App Store app (since iOS 11). It fe

Revamped Download Button. It's kinda a reverse engineering of Netflix's app download button.
Revamped Download Button. It's kinda a reverse engineering of Netflix's app download button.

NFDownloadButton Revamped Download Button Requirements Installation Usage License Requirements iOS 8.0+ Swift 4.2+ Xcode 10.0+ Installation CocoaPods

TTGSnackbar shows simple message and action button on the bottom or top of the screen with multi kinds of animation, which is written in Swift3 and inspired by Snackbar in Android. It also support showing custom view, icon image or multi action button. Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button to button when the user presses on them.
Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button to button when the user presses on them.

Swift-Underlined-Button-Bar Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button

MUDownloadButton -  a Progressive Download button written in pure swift and inspired by AppStore download button
MUDownloadButton - a Progressive Download button written in pure swift and inspired by AppStore download button

MUDownloadButton is a Progressive Download button written in pure swift and inspired by AppStore download button . feel free to contribute and pull requests

Hamburger Menu Button -  A hamburger menu button with full customization
Hamburger Menu Button - A hamburger menu button with full customization

Hamburger Menu Button A hamburger menu button with full customization. Inspired by VinhLe's idea on the Dribble How to use it You can config the looks

Bar Button Item that can be moved anywhere in the screen, like Android's stickers button.
Bar Button Item that can be moved anywhere in the screen, like Android's stickers button.

FlowBarButtonItem Bar Button Item that can be moved anywhere in the screen, like Android's stickers button. [![CI Status](http://img.shields.io/travis

A lightweight, one line setup, iOS / OSX network debugging library! 🦊
A lightweight, one line setup, iOS / OSX network debugging library! 🦊

Netfox provides a quick look on all executed network requests performed by your iOS or OSX app. It grabs all requests - of course yours, requests from

iOS network debugging, like a wizard 🧙‍♂️
iOS network debugging, like a wizard 🧙‍♂️

Start debugging iOS network calls like a wizard, without extra code! Wormholy makes debugging quick and reliable. What you can do: No code to write an

In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.
In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.

The debugger tool for iOS developer. Display logs, network request, device informations, crash logs while using the app. Easy accessible with its bubble head button 🔘 . Easy to integrate in any apps, to handle development or testing apps easier. First version, there is plenty of room for improvement.

A collection of tools for debugging, diffing, and testing your application's data structures.

Custom Dump A collection of tools for debugging, diffing, and testing your application's data structures. Motivation customDump diff XCTAssertNoDiffer

A lightweight, one line setup, iOS / OSX network debugging library! 🦊
A lightweight, one line setup, iOS / OSX network debugging library! 🦊

Netfox provides a quick look on all executed network requests performed by your iOS or OSX app. It grabs all requests - of course yours, requests from

Remote network and data debugging for your native iOS app using Chrome Developer Tools
Remote network and data debugging for your native iOS app using Chrome Developer Tools

PonyDebugger PonyDebugger is a remote debugging toolset. It is a client library and gateway server combination that uses Chrome Developer Tools on you

Set of easy to use debugging tools for iOS developers & QA engineers.
Set of easy to use debugging tools for iOS developers & QA engineers.

DBDebugToolkit DBDebugToolkit is a debugging library written in Objective-C. It is meant to provide as many easily accessible tools as possible while

An in-app debugging and exploration tool for iOS
An in-app debugging and exploration tool for iOS

FLEX FLEX (Flipboard Explorer) is a set of in-app debugging and exploration tools for iOS development. When presented, FLEX shows a toolbar that lives

Chisel is a collection of LLDB commands to assist debugging iOS apps.

Chisel Chisel is a collection of LLDB commands to assist in the debugging of iOS apps. [Installation • Commands • Custom Commands • Development Workfl

Releases(0.1.1)
  • 0.1.1(Sep 17, 2022)

    ✅ 位于Window层级,不会被app内的界面覆盖; ✅ 自适应安全区域,自动靠边,适配横竖屏; ✅ 可执行单个/多个点击事件; ✅ 兼容Objective-C环境调试; ✅ 仅限DEBUG环境; ✅ API简单易用。

    Source code(tar.gz)
    Source code(zip)
Owner
健了个平_(:з」∠)_
Don't forget your original intention.
健了个平_(:з」∠)_
A collection of tools for debugging, diffing, and testing your application's data structures.

Custom Dump A collection of tools for debugging, diffing, and testing your application's data structures. Motivation customDump diff XCTAssertNoDiffer

Point-Free 631 Jan 3, 2023
A lightweight, one line setup, iOS / OSX network debugging library! 🦊

Netfox provides a quick look on all executed network requests performed by your iOS or OSX app. It grabs all requests - of course yours, requests from

Christos Kasketis 3.4k Dec 28, 2022
Remote network and data debugging for your native iOS app using Chrome Developer Tools

PonyDebugger PonyDebugger is a remote debugging toolset. It is a client library and gateway server combination that uses Chrome Developer Tools on you

Square 5.9k Dec 24, 2022
Set of easy to use debugging tools for iOS developers & QA engineers.

DBDebugToolkit DBDebugToolkit is a debugging library written in Objective-C. It is meant to provide as many easily accessible tools as possible while

Dariusz Bukowski 1.2k Dec 30, 2022
An in-app debugging and exploration tool for iOS

FLEX FLEX (Flipboard Explorer) is a set of in-app debugging and exploration tools for iOS development. When presented, FLEX shows a toolbar that lives

FLEXTool 13.3k Dec 31, 2022
Chisel is a collection of LLDB commands to assist debugging iOS apps.

Chisel Chisel is a collection of LLDB commands to assist in the debugging of iOS apps. [Installation • Commands • Custom Commands • Development Workfl

Facebook 8.9k Jan 6, 2023
Next generation debugging framework for iOS

Alpha is the idea of a next generation debugging framework for iOS applications. It combines multiple debugging tools built on top of a simple, unifie

Dal Rupnik 733 Oct 29, 2022
Dotzu In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.

Dotzu In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More. The debugger tool for iOS developer. Display logs, n

Remi ROBERT 1.8k Jan 3, 2023
Droar is a modular, single-line installation debugging window

Droar is a modular, single-line installation debugging window. Overview The idea behind Droar is simple: during app deployment stages, adding quick ap

Myriad Mobile 55 Sep 24, 2022
iOS network debugging, like a wizard 🧙‍♂️

Start debugging iOS network calls like a wizard, without extra code! Wormholy makes debugging quick and reliable. What you can do: No code to write an

Paolo Musolino 2.1k Jan 8, 2023