You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
PadelClub/PadelClub/Views/Components/BarButtonView.swift

35 lines
820 B

//
// BarButtonView.swift
// PadelClub
//
// Created by Razmig Sarkissian on 24/04/2024.
//
import SwiftUI
struct BarButtonView: View {
let accessibilityLabel: String
let icon: String
let action: () -> ()
init(_ accessibilityLabel: String, icon: String, action: @escaping () -> Void) {
self.accessibilityLabel = accessibilityLabel
self.icon = icon
self.action = action
}
var body: some View {
Button(action: {
action()
}) {
if #available(iOS 26.0, *) {
Label(accessibilityLabel, systemImage: icon)
} else {
Image(systemName: icon)
.resizable()
.scaledToFit()
.frame(minHeight: 32)
}
}
}
}