[ADD] Search bar for BrowseView on iOS 15

This commit is contained in:
Fabian Thies
2022-12-12 19:18:57 +01:00
parent 294ba12391
commit 3ce4451da4
5 changed files with 73 additions and 33 deletions

View File

@@ -0,0 +1,29 @@
//
// 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, 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
}
}
}