Skip to content

Commit 796daf7

Browse files
author
Nikola Stojanovic
committed
Add license, add code of conduct, iterate on readme
1 parent 3ca15ef commit 796daf7

File tree

3 files changed

+102
-51
lines changed

3 files changed

+102
-51
lines changed

CODE_OF_CONDUCT.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
We are committed to providing a friendly, safe, and welcoming environment for all contributors, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristics.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to a positive environment:
10+
11+
- **Be respectful** and considerate in your communication
12+
- **Be collaborative** and constructive in your feedback
13+
- **Be patient** with newcomers and those learning
14+
- **Focus on what is best** for the community and project
15+
- **Show empathy** towards other community members
16+
17+
Examples of unacceptable behavior:
18+
19+
- Harassment, discrimination, or prejudicial comments
20+
- Personal attacks or insults
21+
- Trolling or deliberately inflammatory comments
22+
- Public or private harassment
23+
- Publishing others' private information without permission
24+
- Other conduct that could reasonably be considered inappropriate
25+
26+
## Enforcement
27+
28+
Project maintainers are responsible for clarifying standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
29+
30+
Project maintainers have the right to remove, edit, or reject comments, commits, code, issues, and other contributions that are not aligned with this Code of Conduct.
31+
32+
## Reporting
33+
34+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting the project maintainers directly.
35+
36+
All complaints will be reviewed and investigated promptly and fairly. All project maintainers are obligated to respect the privacy and security of the reporter of any incident.
37+
38+
## Attribution
39+
40+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 ConsultingMD
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 41 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,92 +6,82 @@
66
[![Swift Package Manager](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)
77
[![Platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20visionOS-lightgrey.svg)](https://github.com/ConsultingMD/swift-ui-debug-scan)
88

9-
A Swift package designed to enhance your debugging experience with SwiftUI views by providing detailed and structured debug logging.
9+
**Enhanced SwiftUI debugging with structured view insights and render tracking.**
1010

11-
12-
## Why use swift-ui-debug-scan?
13-
14-
Debugging SwiftUI can often feel like navigating a maze, especially when trying to trace metadata such as the file a view belongs to, the module it was declared in, or how often it gets redrawn. This lack of visibility can be particularly challenging in large, server-driven UI applications where static data is sparse, and the codebase is unfamiliar.
15-
16-
swift-ui-debug-scan bridges this gap by offering structured, actionable insights into your SwiftUI views. With this tool, you can easily track view metadata, redraw counts, and other runtime information, making it easier to debug and optimize your SwiftUI applications.
17-
18-
19-
## How it Works
20-
21-
The `.debugScan(_ label: String)` view modifier is the core of this library. By applying this modifier to your SwiftUI views, you can log structured debug information about the view's lifecycle and runtime behavior.
11+
## Quick Start
2212

2313
```swift
2414
import SwiftUI
2515
import SwiftUIDebugScan
2616

2717
struct ContentView: View {
2818
var body: some View {
29-
Text("Some feature").debugScan("Content")
19+
Text("Hello World").debugScan("MainView")
3020
}
3121
}
3222
```
3323

34-
## Sample Debug Output
35-
36-
When running your app in debug mode, you'll see logs like the following in the console:
37-
24+
**Console Output:**
3825
```
39-
🧩 [Content]
26+
🧩 [MainView]
4027
• 📂 file: ContentView.swift
4128
• 📚 module: MyApp
4229
• 🎨 redraws: 1
4330
• ⏱️ timestamp: 2025-07-21 14:05:40 +0000
4431
```
4532

46-
## When to use `.debugScan`?
33+
## Why Use This?
4734

48-
Apply the `.debugScan(_ label: String)` modifier to root views rather than leaf views. This ensures you capture meaningful data about the overall structure and behavior of your app without overwhelming your logs with excessive detail.
35+
- 🔍 **View Metadata**: Track file, module, and render counts
36+
- 🐛 **Debug Complex UIs**: Essential for large, server-driven applications
37+
-**Performance Insights**: Identify over-rendering and optimization opportunities
38+
- 🎯 **Targeted Debugging**: Focus on root views without log noise
4939

50-
For example:
5140

52-
- Use `.debugScan(_ label: String)` on the root view of a screen or a major container view.
53-
- Avoid applying it to small, frequently updated views unless necessary.
41+
## Usage Best Practices
42+
43+
**✅ Apply to root views:**
44+
```swift
45+
NavigationView {
46+
HomeScreen()
47+
}.debugScan("HomeNavigation")
48+
```
5449

55-
## Verbose Mode
50+
**❌ Avoid on leaf views:**
51+
```swift
52+
// Don't do this - too much noise
53+
Text("Button").debugScan("ButtonText")
54+
```
5655

57-
For even more detailed logging, enable verbose mode by setting the `SWIFTUI_DEBUG_SCAN_VERBOSE` environment variable to true, yes, or 1. This will include additional runtime information such as:
56+
**💡 Recommended targets:**
57+
- Screen root views
58+
- Major container views
59+
- Complex custom components
60+
- Views with performance concerns
5861

59-
- Call stack symbols
60-
- Thread details
61-
- System memory and processor usage
62-
- Uptime and elapsed time
62+
## Advanced Features
6363

64-
Verbose mode is especially useful for diagnosing complex issues in large applications.
64+
### Verbose Mode
65+
Set `SWIFTUI_DEBUG_SCAN_VERBOSE=1` for detailed diagnostics:
66+
- 🧵 Call stack and thread info
67+
- 💾 Memory and CPU usage
68+
- ⏱️ Performance timing
69+
- 📊 System metrics
6570

6671
## Installation
6772

68-
Add this package to your project using Swift Package Manager:
69-
73+
**Swift Package Manager:**
7074
```swift
7175
dependencies: [
7276
.package(url: "https://github.com/ConsultingMD/swift-ui-debug-scan", from: "0.1.0")
7377
]
7478
```
7579

76-
Then add the dependency to your target:
77-
78-
```swift
79-
.target(
80-
name: "YourTarget",
81-
dependencies: [
82-
.product(name: "SwiftUIDebugScan", package: "swift-ui-debug-scan")
83-
]
84-
)
85-
```
86-
87-
Alternatively, you can add the package directly in Xcode:
88-
89-
1. Open your project in Xcode.
90-
2. Navigate to `File > Add Packages`.
91-
3. Enter the repository URL: `https://github.com/ConsultingMD/swift-ui-debug-scan`.
92-
4. Choose the version or branch you want to use.
93-
5. Add the package to your desired target.
80+
**Xcode:** `File > Add Packages` → Enter URL above
9481

9582
## Contributing
9683

97-
Contributions are welcome! If you have ideas for new features, improvements, or bug fixes, feel free to open an issue or submit a pull request.
84+
Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
85+
86+
**Quick fixes:** Fork → Change → Test → PR
87+
**New features:** Open issue first to discuss

0 commit comments

Comments
 (0)