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.
32 lines
762 B
32 lines
762 B
//
|
|
// CapsuleViewModifier.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Laurent Morvillier on 17/07/2024.
|
|
//
|
|
|
|
import Foundation
|
|
import SwiftUI
|
|
|
|
struct CapsuleViewModifier: ViewModifier {
|
|
|
|
let foreground: Color
|
|
let background: Color
|
|
|
|
func body(content: Content) -> some View {
|
|
content
|
|
.foregroundStyle(self.foreground)
|
|
.font(.footnote)
|
|
.padding(.horizontal, 8.0)
|
|
.padding(.vertical, 4.0)
|
|
.background(self.background)
|
|
.clipShape(RoundedRectangle(cornerRadius: 8.0, style: .circular))
|
|
|
|
}
|
|
}
|
|
|
|
extension View {
|
|
func capsule(foreground: Color, background: Color) -> some View {
|
|
modifier(CapsuleViewModifier(foreground: foreground, background: background))
|
|
}
|
|
}
|
|
|