Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻

Justin Stanley jstheoriginal

👨‍💻
View GitHub Profile
@jstheoriginal
jstheoriginal / CustomTabView.swift
Last active Oct 29, 2020
SwiftUI TabView With Full Screen Background Color Ignoring Safe Area
View CustomTabView.swift
import SwiftUI
struct ContentView: View {
@State private var currentIndex = 0
private let colors: [Color] = [.red, .white, .blue, .green, .yellow]
private var whiteIsSelected: Bool {
colors[currentIndex] == .white
}
var body: some View {
@jstheoriginal
jstheoriginal / SearchBar.swift
Created Jun 20, 2019
A simple SwiftUI search bar
View SearchBar.swift
struct SearchBar : View {
@Binding var searchText: String
var body: some View {
HStack {
Image(systemName: "magnifyingglass").foregroundColor(.secondary)
TextField(
$searchText,
placeholder: Text("Search")) {
UIApplication.shared.keyWindow?.endEditing(true)