File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 import SwiftUI
1010
1111 /// SwiftUI section that exposes the logger manager's channels as toggles.
12- public struct LoggerChannelsView : View {
12+ public struct LoggerChannelsView < Label : View > : View {
1313 /// Watcher that adapts logger channels for SwiftUI observation.
1414 private let watcher : ChannelWatcher
1515
1616 /// Section title shown above the channel toggles.
17- private let label : LocalizedStringResource
18-
17+ @ ViewBuilder private let label : ( ) -> Label
18+
1919 /// Creates a new section backed by the specified logger manager.
20- public init ( label: LocalizedStringResource = " Log Channels " , manager: Logger . Manager = . shared) {
20+ public init ( label: @escaping ( ) -> Label , manager: Logger . Manager = . shared) {
2121 self . label = label
2222 self . watcher = ChannelWatcher ( manager: manager)
2323 }
2424
25+ /// Creates a new section backed by the specified logger manager.
26+ public init ( manager: Logger . Manager = . shared) where Label == Text {
27+ self . label = { Text ( " All Channels " ) }
28+ self . watcher = ChannelWatcher ( manager: manager)
29+ }
30+
2531 /// Renders the channel settings section and the master toggle.
2632 public var body : some View {
2733 Section ( header: HStack {
28- Text ( label)
34+ label ( )
2935 Spacer ( )
3036 AllChannelsToggleView ( watcher: watcher)
3137 . labelsHidden ( )
You can’t perform that action at this time.
0 commit comments