This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SwiftUI | |
struct TappableColoredText: View { | |
enum Component { | |
case text(String) | |
case tappable(String, () -> Void) | |
} | |
let components: [Component] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct NonContinuousRange<T: Strideable> where T.Stride: SignedInteger { | |
private(set) var ranges: [ClosedRange<T>] = [] | |
mutating func insert(range newRange: ClosedRange<T>) { | |
guard !ranges.isEmpty else { | |
ranges.append(newRange) | |
return | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AVFoundation | |
import MetalPerformanceShaders | |
final class SamplebufferDelegate: NSObject, MTLTextureSource, AVCaptureVideoDataOutputSampleBufferDelegate { | |
var consumer: MTLTextureConsumer? | |
private let device: MTLDevice = MTLCreateSystemDefaultDevice()! | |
private var textureCache: CVMetalTextureCache! | |
private let texAttributes = [kCVMetalTextureUsage as String: [MTLTextureUsage.shaderRead], | |
kCVMetalTextureStorageMode as String: [MTLStorageMode.shared]] as CFDictionary |