From 81426e2e0c38d386b34580cf0bce6c37ef751181 Mon Sep 17 00:00:00 2001 From: david-swift Date: Sun, 24 Sep 2023 13:43:26 +0200 Subject: [PATCH] Add static function for an empty header bar --- Documentation/Reference/structs/HeaderBar.md | 5 +++++ Sources/Adwaita/View/HeaderBar.swift | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/Documentation/Reference/structs/HeaderBar.md b/Documentation/Reference/structs/HeaderBar.md index 694ce75..ed9e65b 100644 --- a/Documentation/Reference/structs/HeaderBar.md +++ b/Documentation/Reference/structs/HeaderBar.md @@ -29,6 +29,11 @@ Initialize a header bar. - start: The start content. - end: The end content. +### `empty()` + +Initialize an empty header bar. +- Returns: The header bar. + ### `start(start:)` Initialize a header bar with only views at the start. diff --git a/Sources/Adwaita/View/HeaderBar.swift b/Sources/Adwaita/View/HeaderBar.swift index 2061e00..71f26b0 100644 --- a/Sources/Adwaita/View/HeaderBar.swift +++ b/Sources/Adwaita/View/HeaderBar.swift @@ -29,6 +29,12 @@ public struct HeaderBar: Widget { self.end = end() } + /// Initialize an empty header bar. + /// - Returns: The header bar. + public static func empty() -> Self { + .init(start: { }, end: { }) + } + /// Initialize a header bar with only views at the start. /// - Parameter start: The views. /// - Returns: The header bar.