Skip to content

Instantly share code, notes, and snippets.

View cdf1982's full-sized avatar
🐺
Exploring

cdf1982 cdf1982

🐺
Exploring
View GitHub Profile
@cdf1982
cdf1982 / AVSpeechSynthGlue.swift
Created June 19, 2024 15:07 — forked from GottaGetSwifty/AVSpeechSynthGlue.swift
Fun example for abstracting delegate into a Type with a closure
import SwiftUI
import AVFoundation
class AVSpeechSynthGlue: NSObject, AVSpeechSynthesizerDelegate {
enum State {
case didStart(AVSpeechUtterance)
case willSpeakRangeOfSpeechString(NSRange)
case willSpeak(AVSpeechSynthesisMarker)
case didPause(AVSpeechUtterance)
case didContinue(AVSpeechUtterance)