mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-09 00:23:20 +01:00
26 lines
646 B
Swift
26 lines
646 B
Swift
import SwiftUI
|
|
|
|
struct DynamicIconModifier: ViewModifier {
|
|
var systemName: String
|
|
var color: Color
|
|
@Binding var condition: Bool
|
|
|
|
func body(content: Content) -> some View {
|
|
HStack {
|
|
if condition {
|
|
Image(systemName: systemName)
|
|
.font(.title2)
|
|
.foregroundColor(color)
|
|
}
|
|
|
|
content
|
|
}
|
|
}
|
|
}
|
|
|
|
extension View {
|
|
func icon(_ systemName: String, color: Color, when condition: Binding<Bool>) -> some View {
|
|
modifier(DynamicIconModifier(systemName: systemName, color: color, condition: condition))
|
|
}
|
|
}
|