Skip to content

Instantly share code, notes, and snippets.

View ryanlintott's full-sized avatar

Ryan Lintott ryanlintott

View GitHub Profile
@ryanlintott
ryanlintott / addfont.cmd
Last active December 19, 2015 07:39 — forked from heldr/addfont.cmd
Updated for font files with spaces
View addfont.cmd
REM http://www.msfn.org/board/topic/119612-how-to-install-a-font-via-the-command-line/
@ECHO OFF
TITLE Adding Fonts..
REM Filename: ADD_Fonts.cmd
REM Script to ADD TrueType and OpenType Fonts for Windows
REM By Islam Adel
REM 2012-01-16
REM How to use:
@ryanlintott
ryanlintott / NoClipText.swift
Last active August 20, 2021 02:40
Alternative Text view for SwiftUI with an extendable clipping area. This is a fix for certain fonts and characters that have a clipped intrinsic size.
View NoClipText.swift
import SwiftUI
import UIKit
struct NoClipText: UIViewRepresentable {
typealias UIViewType = NoClipLabel
let text: String
let font: UIFont
let clipExtension: EdgeSizes
@ryanlintott
ryanlintott / OverlappingImage.swift
Last active December 11, 2020 20:39
An image that will overlap content based on a percent of height or width. This allows an overlap to occur in the same location regardless of scale.
View OverlappingImage.swift
import SwiftUI
struct OverlappingImage: View {
let uiImage: UIImage
let xShift: CGFloat
let yShift: CGFloat
let newAspect: CGFloat
init(_ uiImage: UIImage, top: CGFloat = 0, bottom: CGFloat = 0) {
self.uiImage = uiImage
@ryanlintott
ryanlintott / CustomColorScheme.swift
Last active July 30, 2023 10:26
Custom color scheme view modifier for SwiftUI. Sets the color scheme to light mode, dark mode, or matches the system. If set to match, the app will respond to system-wide color scheme changes properly. A simple widget color scheme implementation is also provided.
View CustomColorScheme.swift
import SwiftUI
enum CustomColorScheme: Int, CaseIterable, Identifiable, Codable {
static var defaultKey = "customColorScheme"
static var defaultValue = CustomColorScheme.system
case system = 0
case light = 1
case dark = 2
@ryanlintott
ryanlintott / AVSpeechSynthesizer-IPASpeech-extension.swift
Last active October 12, 2022 13:47
Extension to AVSpeechSynthesizer that will speak IPA (International Phonetic Alphabet) strings
View AVSpeechSynthesizer-IPASpeech-extension.swift
import Foundation
import AVFoundation
@available(iOS 10.0, *)
extension AVSpeechSynthesizer {
func speakIPA(_ ipaString: String, voiceIdentifier: String, willSpeak: ((String) -> Void)? = nil) {
//Set the audio session to playback to ignore mute switch on device
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, options: [.interruptSpokenAudioAndMixWithOthers, .duckOthers])
} catch {
@ryanlintott
ryanlintott / LazyDataVStack.swift
Created October 27, 2021 16:48
LazyDataVStack
View LazyDataVStack.swift
//
// LazyDataVStack.swift
//
//
// Created by Ryan Lintott on 2021-03-31.
//
import SwiftUI
import CoreData
@ryanlintott
ryanlintott / InfoDictionary.swift
Last active April 5, 2022 22:51
RotationMatchingOrientationViewModifier
View InfoDictionary.swift
//
// InfoDictionary.swift
// FrameUp
//
// Created by Ryan Lintott on 2021-05-11.
//
import SwiftUI
struct InfoDictionary {
@ryanlintott
ryanlintott / image-expansion.swift
Last active May 17, 2022 15:53 — forked from robb/image-expansion.swift
Image that can be revealed between other elements in a VStack.
View image-expansion.swift
import SwiftUI
struct ContentView: View {
@State private var pictureExpanded = false
var body: some View {
VStack(alignment: .leading, spacing: 20.0) {
Text("Once upon a time there was a turtle named George who made friends with a giraffe at the local water park and then they went on lots of adventures together.")
Button {
@ryanlintott
ryanlintott / LayoutThatFits.swift
Last active December 8, 2023 15:14
An alternative to ViewThatFits. Updated version can be found here: https://github.com/ryanlintott/LayoutThatFits
View LayoutThatFits.swift
//
// LayoutThatFits.swift
// WWDC22Experiments
//
// Created by Ryan Lintott on 2022-06-08.
//
import SwiftUI
struct LayoutThatFits: Layout {
@ryanlintott
ryanlintott / FlippableView.swift
Created July 11, 2022 19:30
A view that flips with a drag gesture.
View FlippableView.swift
//
// FlippableView.swift
// FrameUpExample
//
// Created by Ryan Lintott on 2022-07-11.
//
import SwiftUI
struct FlippableView: View {