diff options
| author | Fuwn <[email protected]> | 2025-06-15 00:45:53 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-06-15 00:45:53 -0700 |
| commit | 8941deac5766609cbb0d039c8390afb2febae635 (patch) | |
| tree | 39db5f2c16793ef649a4070c8366bb576fee477e /Sora/Views/PlatformSpecificToolbarItem.swift | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-8941deac5766609cbb0d039c8390afb2febae635.tar.xz sora-testing-8941deac5766609cbb0d039c8390afb2febae635.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Views/PlatformSpecificToolbarItem.swift')
| -rw-r--r-- | Sora/Views/PlatformSpecificToolbarItem.swift | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Sora/Views/PlatformSpecificToolbarItem.swift b/Sora/Views/PlatformSpecificToolbarItem.swift index 7c2fb86..4a44db0 100644 --- a/Sora/Views/PlatformSpecificToolbarItem.swift +++ b/Sora/Views/PlatformSpecificToolbarItem.swift @@ -1,9 +1,19 @@ import SwiftUI struct PlatformSpecificToolbarItem<Content: View>: ToolbarContent { + let placement: ToolbarItemPlacement let content: () -> Content - init(@ViewBuilder content: @escaping () -> Content) { + init( + placement: ToolbarItemPlacement?, + @ViewBuilder content: @escaping () -> Content + ) { + #if os(macOS) + self.placement = .automatic + #else + self.placement = placement ?? .bottomBar + #endif + self.content = content } @@ -13,7 +23,7 @@ struct PlatformSpecificToolbarItem<Content: View>: ToolbarContent { content() } #else - ToolbarItem(placement: .bottomBar) { + ToolbarItem(placement: placement) { content() } #endif |