AI prompts
base on A toolkit to make debugging iOS applications easier 🚀 # DebugSwift
<p align="center">
<img src="https://img.shields.io/badge/Platforms-iOS%2012.0+-blue.svg"/>
<img src="https://img.shields.io/github/v/release/DebugSwift/DebugSwift?style=flat&label=CocoaPods"/>
<img src="https://img.shields.io/github/v/release/DebugSwift/DebugSwift?style=flat&label=Swift%20Package%20Index&color=red"/>
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FDebugSwift%2FDebugSwift%2Fbadge%3Ftype%3Dswift-versions"/>
<img src="https://img.shields.io/github/license/DebugSwift/DebugSwift?style=flat"/>
</p>
| <img width="300" src="https://github.com/DebugSwift/DebugSwift/assets/31082311/3d219290-ba08-441a-a4c7-060f946683c2"> | <div align="left" >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.</div> |
|---|---|







## 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`:
```ruby
pod 'DebugSwift', :git => 'https://github.com/DebugSwift/DebugSwift.git', :branch => 'main'
```
Then, run:
```bash
pod install
```
#### Swift Package Manager (SPM)
Add the following dependency to your `Package.swift` file:
```swift
.package(url: "https://github.com/DebugSwift/DebugSwift.git", from: "main")
```
Then, add `"DebugSwift"` to your target's dependencies.
### Usage
```swift
func application(
_: UIApplication,
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
DebugSwift.setup()
DebugSwift.show()
return true
}
```
### Usage to show or hide with shake.
```swift
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:
```swift
DebugSwift.Network.ignoredURLs = ["https://reqres.in/api/users/23"]
```
If you want to capture only a specific URL, use the following code:
```swift
DebugSwift.Network.onlyURLs = ["https://reqres.in/api/users/23"]
```
Adjust the URLs in the arrays according to your needs.
### App Custom Data
```swift
DebugSwift.App.customInfo = {
[
.init(
title: "Info 1",
infos: [
.init(title: "title 1", subtitle: "title 2")
]
)
]
}
```
#### Results:

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

---
### App Custom ViewControllers in Tab Bar
```swift
DebugSwift.App.customControllers = {
let controller1 = UITableViewController()
controller1.title = "Custom TableVC 1"
let controller2 = UITableViewController()
controller2.title = "Custom TableVC 2"
return [controller1, controller2]
}
```
---
### Hide or disable 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
```swift
func application(
_: UIApplication,
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
DebugSwift.setup(
// Main features
hideFeatures: [
.network,
.resources,
.performance,
.interface,
.app
],
// Swizzle features
disable: [
.network,
.location,
.views,
.crashManager,
.leaksDetector,
.console
]
)
DebugSwift.show()
return true
}
```
#### Results:

---
### Collect Memory Leaks
Get the data from memory leaks in the app.
#### Usage
```swift
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:

---
### Change Appearance
Dynamic Theme: Easily Change the Interface Appearance from Dark to Light, Customize According to Your Needs.
#### Usage
```swift
func application(
_: UIApplication,
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
DebugSwift.theme(appearance: .light)
DebugSwift.setup()
DebugSwift.show()
return true
}
```
#### Results:

---
### 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:

#### 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:

---
## Fixing Errors
### Alamofire
#### Not called `uploadProgress`
In the `AppDelegate`.
```swift
class AppDelegate {
func application(
_: UIApplication,
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
DebugSwift.setup()
DebugSwift.show()
// Call this method
DebugSwift.Network.delegate = self
return true
}
}
```
And conform with the protocol:
```swift
extension AppDelegate: CustomHTTPProtocolDelegate {
func urlSession(
_ protocol: URLProtocol,
_ session: URLSession,
task: URLSessionTask,
didSendBodyData bytesSent: Int64,
totalBytesSent: Int64,
totalBytesExpectedToSend: Int64
) {
Session.default.session.getAllTasks { tasks in
let uploadTask = tasks.first(where: { $0.taskIdentifier == task.taskIdentifier }) ?? task
Session.default.rootQueue.async {
Session.default.delegate.urlSession(
session,
task: uploadTask,
didSendBodyData: bytesSent,
totalBytesSent: totalBytesSent,
totalBytesExpectedToSend: totalBytesExpectedToSend
)
}
}
}
}
```
---
## ⭐ Support the Project by Leaving a Star!
Thank you for visiting our project! If you find our work helpful and would like to support us, please consider giving us a ⭐ star on GitHub. Your support is crucial for us to continue improving and adding new features.
### Why Should You Star the Project?
- **Show Your Support**: Let us know that you appreciate our efforts.
- **Increase Visibility**: Help others discover this project.
- **Stay Updated**: Get notifications on updates and new releases.
- **Motivate Us**: Encouragement from the community keeps us going!
### How to Leave a Star
1. **Log in** to your GitHub account.
2. **Navigate** to the top of this repository page.
3. **Click** on the "Star" button located at the top-right corner.
Every star counts and makes a difference. Thank you for your support! 😊
[](https://github.com/DebugSwift/DebugSwift)
---
## Contributors
Our contributors have made this project possible. Thank you!
<a href="https://github.com/DebugSwift/DebugSwift/graphs/contributors">
<img src="https://contrib.rocks/image?repo=DebugSwift/DebugSwift" />
</a>
## 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

## Star History
[](https://star-history.com/#DebugSwift/DebugSwift&Date)
---
## License
DebugSwift is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## References
- [InAppViewDebugger](https://github.com/indragiek/InAppViewDebugger)
- [CocoaDebug](https://github.com/CocoaDebug/CocoaDebug)
- [DBDebugToolkit](https://github.com/dbukowski/DBDebugToolkit)
- [LeakedViewControllerDetector](https://github.com/Janneman84/LeakedViewControllerDetector)
", Assign "at most 3 tags" to the expected json: {"id":"12656","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"