一个便捷的树状可视化工具,适用于使用 Nodes Architecture Framework 的应用程序
13.0
5.8
https://swiftpackageindex.cn/Tinder/collection.json
Package Dependency(包依赖)
将
<version>
替换为所需的最低版本。
.package(url: "https://github.com/Tinder/Nodes-Tree-Visualizer.git", from: "<version>")
Target Dependency(目标依赖)
.product(name: "NodesSocketIO", package: "Nodes-Tree-Visualizer")
Package Dependency(包依赖)
https://github.com/Tinder/Nodes-Tree-Visualizer.git
Target Dependency(目标依赖)
NodesSocketIO
提示
以下 Git diff 演示了如何在 Nodes 快速入门项目中安装。
diff --git a/project.yml b/project.yml
index 224200a..b303c0e 100644
--- a/project.yml
+++ b/project.yml
@@ -103,6 +103,9 @@ packages:
Nodes:
url: https://github.com/Tinder/Nodes.git
version: 1.0.0
+ Nodes-Tree-Visualizer:
+ url: https://github.com/Tinder/Nodes-Tree-Visualizer.git
+ version: 1.0.0 # use the latest available version
NeedleFoundation:
url: https://github.com/uber/needle.git
version: 0.25.1
@@ -120,6 +123,8 @@ targets:
platform: iOS
dependencies:
- package: Nodes
+ - package: Nodes-Tree-Visualizer
+ product: NodesSocketIO
- package: NeedleFoundation
preBuildScripts:
- name: Nodes
当应用程序启动完成后,连接 socket 以便能够将必要的调试信息发送到 Web 应用程序。
import NodesSocketIO
#if DEBUG
private let debugSocket: DebugSocket<UIViewController> = .init()
#endif
#if DEBUG
debugSocket.connect()
#endif
提示
以下 Git diff 演示了如何在 Nodes 快速入门项目中进行设置。
diff --git a/Example/Sources/AppDelegate.swift b/Example/Sources/AppDelegate.swift
index 2de56d8..7cc009d 100644
--- a/Example/Sources/AppDelegate.swift
+++ b/Example/Sources/AppDelegate.swift
@@ -2,6 +2,7 @@
// Created by Tinder on 12/1/24.
//
+import NodesSocketIO
import UIKit
@main
@@ -14,6 +15,10 @@ internal final class AppDelegate: UIResponder, UIApplicationDelegate {
private lazy var appFlow: AppFlow = appBuilder.build()
+ #if DEBUG
+ private let debugSocket: DebugSocket<UIViewController> = .init()
+ #endif
+
internal convenience init(appBuilder: AppBuilder) {
self.init()
self.appBuilder = appBuilder
@@ -33,6 +38,7 @@ internal final class AppDelegate: UIResponder, UIApplicationDelegate {
else { return appFlow.start() }
guard NSClassFromString("XCTestCase") == nil
else { return }
+ debugSocket.connect()
#endif
registerProviderFactories()
appFlow.start()
对于非 UIKit 应用程序或要自定义视图渲染,请向 DebugSocket
初始化器提供一个闭包。
let debugSocket: DebugSocket<UIViewController> = .init { viewController in
let view: UIView = viewController.view
let renderer: UIGraphicsImageRenderer = .init(bounds: view.bounds)
let image: UIImage = renderer.image { view.layer.render(in: $0.cgContext) }
return image.jpegData(compressionQuality: compressionQuality)
}
使用本地 Web 服务器来查看树状结构。
brew install node
git clone git@github.com:Tinder/Nodes-Tree-Visualizer.git
cd Nodes-Tree-Visualizer
make serve
复制并粘贴到浏览器中
https://:3000
从命令行在浏览器中打开
open https://:3000
感谢您对本项目贡献的兴趣,但我们开源此项目仅是为了与社区分享。这意味着我们目前无法接受外部贡献,并且拉取请求将不会被审查或合并。要报告安全问题或漏洞,请提交 GitHub issue。