Fix interfaces for tvOS
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
public struct BackButton: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
public var body: some View {
|
||||
Button {
|
||||
dismiss()
|
||||
} label: {
|
||||
Image(systemName: "chevron.backward")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,3 +83,18 @@ public func FormButton(role: ButtonRole?, action: @escaping () -> Void, @ViewBui
|
||||
.foregroundColor(.accentColor)
|
||||
#endif
|
||||
}
|
||||
|
||||
public func FormNavigationLink(@ViewBuilder destination: () -> some View, @ViewBuilder label: () -> some View) -> some View {
|
||||
#if !os(tvOS)
|
||||
return NavigationLink(destination: destination, label: label)
|
||||
#else
|
||||
return NavigationLink(destination: {
|
||||
destination()
|
||||
.toolbar {
|
||||
ToolbarItemGroup(placement: .topBarLeading) {
|
||||
BackButton()
|
||||
}
|
||||
}
|
||||
}, label: label)
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user