Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbaird committed Feb 27, 2024
1 parent bfc6db6 commit 2ebe9e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ struct MenuBarSettingsPane: View {

var body: some View {
CustomTabView(selection: $selection) {
CustomTab {
Text("Appearance")
} content: {
CustomTab("Appearance") {
MenuBarAppearanceTab()
}
CustomTab {
Text("Layout")
} content: {
CustomTab("Layout") {
MenuBarLayoutTab()
}
}
Expand Down
8 changes: 8 additions & 0 deletions Ice/UI/Views/CustomTabView/CustomTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ struct CustomTab {
self.label = AnyView(label())
self.content = AnyView(content())
}

/// Creates a tab with the given label and content view.
init<Content: View>(
_ labelKey: LocalizedStringKey,
@ViewBuilder content: () -> Content
) {
self.init(label: { Text(labelKey) }, content: content)
}
}

0 comments on commit 2ebe9e0

Please sign in to comment.