Skip to content

Instantly share code, notes, and snippets.


Justin Stanley jstheoriginal

View GitHub Profile
jstheoriginal / BottomAnchoredModalTransitioner.swift
Last active Apr 14, 2021
A bottom anchored modal (bottom sheet) that allows adding a child view controller. It will self-size itself based on the content in the child view controller. It respects the safe area, including having a max height. To ensure content can be fully viewed if it hits the max height, the child view controller needs to have a tableview or scrollview.
View BottomAnchoredModalTransitioner.swift
// BottomAnchoredModalTransitioner.swift
// BB Links
// Created by Justin Stanley on 2017-09-07.
// Copyright © 2017 Justin Stanley. All rights reserved.
import Foundation
import UIKit
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 / 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)
placeholder: Text("Search")) {