AddressContext lets address-action providers branch on whether the site is code/function/data; the tracer offers a function vs instruction hook accordingly. ThreadActionProvider mirrors the pattern for thread targets so UI code stays oblivious to which instrument owns a given action.
34 lines
853 B
Swift
34 lines
853 B
Swift
import Foundation
|
|
|
|
public struct ThreadAction: Identifiable, Sendable {
|
|
public enum Role: Sendable {
|
|
case normal
|
|
case destructive
|
|
}
|
|
|
|
public let id: UUID
|
|
public let title: String
|
|
public let systemImage: String?
|
|
public let role: Role
|
|
public let perform: @MainActor @Sendable () async -> NavigationTarget?
|
|
|
|
public init(
|
|
id: UUID = UUID(),
|
|
title: String,
|
|
systemImage: String? = nil,
|
|
role: Role = .normal,
|
|
perform: @escaping @MainActor @Sendable () async -> NavigationTarget?
|
|
) {
|
|
self.id = id
|
|
self.title = title
|
|
self.systemImage = systemImage
|
|
self.role = role
|
|
self.perform = perform
|
|
}
|
|
}
|
|
|
|
public typealias ThreadActionProvider = @MainActor @Sendable (
|
|
_ sessionID: UUID,
|
|
_ thread: ProcessThread
|
|
) -> [ThreadAction]
|