Skip to content

Instantly share code, notes, and snippets.

View kylehughes's full-sized avatar
🐶
Updog

Kyle Hughes kylehughes

🐶
Updog
View GitHub Profile
@kylehughes
kylehughes / .gitignore
Created March 23, 2013 20:38 — forked from adamgit/.gitignore
A thoroughly thought out .gitignore for Xcode projects.
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
@kylehughes
kylehughes / dbh-video.xml
Created September 4, 2018 08:00
dbh-video
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:atom="http://www.w3.org/2005/Atom/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel>
<title>The Dan Benjamin Hour with Video</title>
<link>http://web.5by5.tv/dbh</link>
<pubDate>Tue, 02 Jun 2015 22:00:00 GMT</pubDate>
<description>The Dan Benjamin Hour is a live daily talk show exploring the latest in geek culture, technology, gear, and entertainment, catching emerging stories before they become headlines and skirting the mainstream with wide-ranging topics, unorthodox opinions, an offbeat in-studio crew, an expansive guest list, and calls from live listeners. Dan's irreverent sense of humor and interview style bring a fresh perspective each weekday. Hosted by Da
@kylehughes
kylehughes / Collector.swift
Created May 27, 2020 18:55
Batch Collector Implementation
//
// Collector.swift
// InformationSuperhighway
//
// Created by Kyle Hughes on 2/26/20.
// Copyright © 2020 Kyle Hughes. All rights reserved.
//
final class Collector<Item> {
typealias FlushHandler = ([Item]) -> Void
@kylehughes
kylehughes / Grid.swift
Last active January 2, 2022 03:13
A view modifier for SwiftUI that renders a configurable grid on top of the view. It is useful while designing in code.
// Copyright 2022 Kyle Hughes
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
// Software.
//
@kylehughes
kylehughes / ios-settings-deep-links.md
Last active January 11, 2022 22:20
Deep links in the iOS Settings app.
@kylehughes
kylehughes / View+Conditional.swift
Created August 28, 2020 06:34
SwiftUI: Conditionally Configuring Views
import SwiftUI
public extension View {
// MARK: Conditionally Configuring Views
@ViewBuilder func `if`<TrueView>(
_ condition: Bool,
transform: (Self) -> TrueView
) -> some View where TrueView: View {
if condition {
@kylehughes
kylehughes / HapticFeedback.swift
Last active May 17, 2022 15:46
Convenient Swift abstractions for generating haptic feedback on iOS.
// Copyright 2021 Kyle Hughes
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
// Software.
//
@kylehughes
kylehughes / MediaPicker.swift
Created September 6, 2022 21:24
MPMediaPickerController wrapped for SwiftUI
//
// MediaPicker.swift
// Music Triage
//
// Created by Kyle Hughes on 9/6/22.
//
import Foundation
import MediaPlayer
import SwiftUI
@kylehughes
kylehughes / StandardSizeChangeViaTraitCollectionViewController.swift
Created November 30, 2022 04:45
View controller that can override the content size category of a single child via the standard size change edit actions.
import UIKit
public final class StandardSizeChangeViaTraitCollectionViewController<Base>:
UIViewController
where
Base: UIViewController
{
public let base: Base
// MARK: Public Initialization
@kylehughes
kylehughes / LosslessStringConvertibleCodable.swift
Last active February 20, 2023 04:35
An example of how to implement Codable support for a type that conforms to LosslessStringConvertible.
// MARK: - Default Decodable Implementation
extension Decodable where Self: LosslessStringConvertible {
// MARK: Public Initialization
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let stringValue = try container.decode(String.self)
guard let value = Self(stringValue) else {