Remove local branches which are gone in remote
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
// Handy Persistence class in Swift which use `subscript` syntax | |
final class Persistence { | |
struct Key<Value> { | |
let name: String | |
} | |
private let userDefaults: UserDefaults | |
init(userDefaults: UserDefaults = UserDefaults.standard) { |
import SwiftUI | |
extension View { | |
func halfModal<Sheet: View>( | |
showing: Binding<Bool>, | |
@ViewBuilder sheet: @escaping () -> Sheet | |
) -> some View { | |
background( | |
HalfModalSheet( | |
sheet: sheet, |
Remove local branches which are gone in remote
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
extension UITableView { | |
func register<T: UITableViewCell>(nibCellType: T.Type) { | |
let className = nibCellType.className | |
let nib = UINib(nibName: className, bundle: nil) | |
register(nib, forCellReuseIdentifier: className) | |
} | |
func register<T: UITableViewCell>(cellType: T.Type) { | |
let className = cellType.className | |
register(cellType, forCellReuseIdentifier: className) |