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
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 / 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.
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 / 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.
import SwiftUI
import UIKit
struct NoClipText: UIViewRepresentable {
typealias UIViewType = NoClipLabel
let text: String
let font: UIFont
let clipExtension: EdgeSizes
@ryanlintott
ryanlintott / LazyDataVStack.swift
Created October 27, 2021 16:48
LazyDataVStack
//
// 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
//
// 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.
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 / TwoSidedView.swift
Created July 11, 2022 22:26
A two sided view that can be flipped with a drag gesture.
//
// TwoSidedView.swift
// FrameUpExample
//
// Created by Ryan Lintott on 2022-07-11.
//
import SwiftUI
struct TwoSidedView<UpContent: View, DownContent: View>: View {
@ryanlintott
ryanlintott / ShirtThatFits.swift
Created August 8, 2022 16:20
A SwiftUI view that uses ViewThatFits to present an SFSymbol tshirt that fits.
//
// ShirtThatFits.swift
// ShirtThatFits
//
// Created by Ryan Lintott on 2022-08-05.
//
import SwiftUI
enum Shirt: Int, RawRepresentable, CaseIterable, Identifiable, Hashable, Codable, View {
@ryanlintott
ryanlintott / FlippableView.swift
Created July 11, 2022 19:30
A view that flips with a drag gesture.
//
// FlippableView.swift
// FrameUpExample
//
// Created by Ryan Lintott on 2022-07-11.
//
import SwiftUI
struct FlippableView: View {
@ryanlintott
ryanlintott / AVSpeechSynthesizer-IPASpeech-extension.swift
Last active October 12, 2022 13:47
Extension to AVSpeechSynthesizer that will speak IPA (International Phonetic Alphabet) strings
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 {