Skip to content

Instantly share code, notes, and snippets.

View Koshimizu-Takehito's full-sized avatar
🏝️

takehito Koshimizu-Takehito

🏝️
View GitHub Profile
import SwiftUI
// Xcode: 16.0
// Swift: 6.0
struct EnumPicker<Enum>: View where Enum: CaseIterable & Hashable, Enum == Enum.AllCases.Element, Enum.AllCases: RandomAccessCollection {
@Binding var selection: Enum
var body: some View {
Picker(String(describing: Enum.self), selection: $selection) {
ForEach(Enum.allCases, id: \.self) { value in
@Koshimizu-Takehito
Koshimizu-Takehito / StreamReader.swift
Created February 17, 2019 02:24 — forked from sooop/StreamReader.swift
Read a large text file line by line - Swift 3
import Foundation
class StreamReader {
let encoding: String.Encoding
let chunkSize: Int
let fileHandle: FileHandle
var buffer: Data
let delimPattern : Data
var isAtEOF: Bool = false