Giter Site home page Giter Site logo

debugswift / debugswift Goto Github PK

View Code? Open in Web Editor NEW
314.0 6.0 25.0 1004 KB

A toolkit to make debugging iOS applications easier ๐Ÿš€

Home Page: https://cocoapods.org/pods/DebugSwift

License: MIT License

Swift 99.86% Ruby 0.14%
cocoadebug debug swift ui uikit view analysis analytics crashlytics layout-debugger logs-analysis performance-analysis qa cocoapods debugger debugging log networking sandbox

debugswift's Introduction

DebugSwift

DebugSwift is a comprehensive toolkit designed to simplify and enhance the debugging process for Swift-based applications. Whether you're troubleshooting issues or optimizing performance, DebugSwift provides a set of powerful features to make your debugging experience more efficient.

image1 image2 image3 image4 image5 image6 image11

Features

App Settings

  • Crash Reports: Access detailed crash reports for analysis and debugging.
  • Change Location: Simulate different locations for testing location-based features.
  • Console: Monitor and interact with the application's console logs.
  • Custom Info: Add custom information for quick access during debugging.
  • Version: View the current application version.
  • Build: Identify the application's build number.
  • Bundle Name: Retrieve the application's bundle name.
  • Bundle ID: Display the unique bundle identifier for the application.
  • Device Infos: Access information about the device running the application.

Interface

  • Grid: Overlay a grid on the interface to assist with layout alignment.
  • Slow Animations: Slow down animations for better visualization and debugging.
  • Showing Touches: Highlight touch events for easier interaction tracking.
  • Colorized View with Borders: Apply colorization and borders to views for improved visibility.

Network Logs

  • All Response/Request Logs: Capture and review detailed logs of all network requests and responses.

Performance

  • CPU, Memory, FPS, Memory Leak Detector: Monitor and analyze CPU usage, memory consumption, and frames per second in real-time.

Resources

  • Keychain: Inspect and manage data stored in the keychain.
  • User Defaults: View and modify user defaults for testing different application states.
  • Files: Access and analyze files stored by the application.

Getting Started

Installation

CocoaPods

Add the following line to your Podfile:

pod 'DebugSwift', :git => 'https://github.com/DebugSwift/DebugSwift.git', :branch => 'main'

Then, run:

pod install

Swift Package Manager (SPM)

Add the following dependency to your Package.swift file:

.package(url: "https://github.com/DebugSwift/DebugSwift.git", from: "main")

Then, add "DebugSwift" to your target's dependencies.

Usage

func application(
    _: UIApplication,
    didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    DebugSwift.setup()
    DebugSwift.show()

    return true
}

Usage to show or hide with shake.

extension UIWindow {
    open override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
        super.motionEnded(motion, with: event)
        
        if motion == .motionShake {
            DebugSwift.toggle()
        }
    }
}

Customization

Network Configuration

If you want to ignore specific URLs, use the following code:

DebugSwift.Network.ignoredURLs = ["https://reqres.in/api/users/23"]

If you want to capture only a specific URL, use the following code:

DebugSwift.Network.onlyURLs = ["https://reqres.in/api/users/23"]

Adjust the URLs in the arrays according to your needs.

App Custom Data

DebugSwift.App.customInfo = {
    [
        .init(
            title: "Info 1",
            infos: [
                .init(title: "title 1", subtitle: "title 2")
            ]
        )
    ]
}

Results:

image5


App Custom Action

DebugSwift.App.customAction = {
    [
        .init(
            title: "Action 1",
            actions: [
                .init(title: "action 1") { [weak self] in // Important if use self
                    print("Action 1")
                }
            ]
        )
    ]
}

Results:

image6


App Custom ViewControllers in Tab Bar

DebugSwift.App.customControllers = {
    let controller1 = UITableViewController()
    controller1.title = "Custom TableVC 1"

    let controller2 = UITableViewController()
    controller2.title = "Custom TableVC 2"
    return [controller1, controller2]
}

Hide Some Features

If you prefer to selectively disable certain features, DebugSwift can now deactivate unnecessary functionalities. This can assist you in development across various environments.

Usage

func application(
    _: UIApplication,
    didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    DebugSwift.setup(hideFeatures: [.resources,.performance,.interface,.app]) // Example usage for hide resources, performance, interface & app
    DebugSwift.show()

    return true
}

Results:

image9


Collect Memory Leaks

Get the data from memory leaks in the app.

Usage

DebugSwift.Performance.LeakDetector.onDetect { data in
    // If you want to send data to some analytics

    print(data.message) // Retuns the name of the class and the error
    print(data.controller) // If is an controller leak
    print(data.view) // If is an view leak
    print(data.isDeallocation) // If is an deallocation of leak (good for false/positive)
}

Results:

image12


Change Appearance

Dynamic Theme: Easily Change the Interface Appearance from Dark to Light, Customize According to Your Needs.

Usage

func application(
    _: UIApplication,
    didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    DebugSwift.theme(appearance: .light)
    DebugSwift.setup()
    DebugSwift.show()

    return true
}

Results:

image7


Enhanced Hierarchy Tree for Deeper Application Insights (Beta)

Harness the Power of Visual Information within the iOS Hierarchy Tree to Uncover Intricate Layouts and Element Relationships in Your Application.

How to Use

Simply press and hold the circle button to reveal the Snapshot and Hierarchy for a comprehensive overview.

Results:

image8

Explore Additional Details

Enhance your understanding by pressing and holding on a specific view to reveal information such as:

  • Class
  • Subviews
  • Background Color
  • Specific attributes based on the type (e.g., UILabel: Text, Font, and TextColor).

Results:

image10


Contributors

Our contributors have made this project possible. Thank you!

Contributing

Contributions are welcome! If you have suggestions, improvements, or bug fixes, please submit a pull request. Let's make DebugSwift even more powerful together!


Repo Activity

Alt

Star History

Star History Chart


License

DebugSwift is licensed under the MIT License - see the LICENSE file for details.

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.