mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
36 lines
847 B
Swift
36 lines
847 B
Swift
//
|
|
// Modifiers.swift
|
|
// SideStore
|
|
//
|
|
// Created by Fabian Thies on 01.12.22.
|
|
// Copyright © 2022 SideStore. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
extension View {
|
|
|
|
@ViewBuilder func `if`<Content: View>(_ condition: Bool, @ViewBuilder transform: (Self) -> Content) -> some View {
|
|
if condition {
|
|
transform(self)
|
|
} else {
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
@ViewBuilder func searchable(text: Binding<String>, placeholder: String) -> some View {
|
|
if #available(iOS 15.0, *) {
|
|
self.searchable(text: text, prompt: Text(placeholder))
|
|
} else {
|
|
self
|
|
}
|
|
}
|
|
|
|
@ViewBuilder func tintedBackground(_ color: Color) -> some View {
|
|
self
|
|
.blurBackground(.systemUltraThinMaterial)
|
|
.background(color.opacity(0.4))
|
|
}
|
|
}
|