summaryrefslogtreecommitdiff
path: root/Sora/Views/PlatformSpecificToolbarItem.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-06-15 00:45:53 -0700
committerFuwn <[email protected]>2025-06-15 00:45:53 -0700
commit8941deac5766609cbb0d039c8390afb2febae635 (patch)
tree39db5f2c16793ef649a4070c8366bb576fee477e /Sora/Views/PlatformSpecificToolbarItem.swift
parentfeat: Development commit (diff)
downloadsora-testing-8941deac5766609cbb0d039c8390afb2febae635.tar.xz
sora-testing-8941deac5766609cbb0d039c8390afb2febae635.zip
feat: Development commit
Diffstat (limited to 'Sora/Views/PlatformSpecificToolbarItem.swift')
-rw-r--r--Sora/Views/PlatformSpecificToolbarItem.swift14
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