Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rayfix
rayfix / fiindsize.swift
Created February 7, 2016 05:30
Getting the Size of a file or directory in Swift
//
// main.swift
// findsize
//
// Created by Ray Fix on 2/6/16.
// Copyright © 2016 Neko Labs. All rights reserved.
//
import Foundation
@rayfix
rayfix / DemoLister.swift
Created December 11, 2021 19:57
Using IdentifiedCollection package to manage large lists in SwiftUI
//
// ContentView.swift
// DemoLister
//
// Created by Ray Fix on 12/11/21.
//
import SwiftUI
import IdentifiedCollections
@rayfix
rayfix / DataGrid.swift
Created November 14, 2020 20:50
A SwiftUI 2D Grid
//
// ContentView.swift
// DataGrid
//
// Created by Ray Fix on 11/14/20.
//
import SwiftUI
struct DataGrid<Element> {
@rayfix
rayfix / boolean-sequences.swift
Created July 10, 2021 23:32
R-Style Boolean Sequence Selectors in Swift
extension Sequence where Element: Comparable {
static func ==(_ lhs: Self, _ rhs: Element) -> LazyMapSequence<Self, Bool> {
lhs.lazy.map { $0 == rhs }
}
static func !=(_ lhs: Self, _ rhs: Element) -> LazyMapSequence<Self, Bool> {
lhs.lazy.map { $0 != rhs }
}
static func <(_ lhs: Self, _ rhs: Element) -> LazyMapSequence<Self, Bool> {
//
// ContentView.swift
// CopyOnWrite
//
// Created by Ray Fix on 3/27/21.
//
import SwiftUI
struct CowType {
//
// ContentView.swift
// Slider
//
// Created by Ray Fix on 2/20/21.
//
import SwiftUI
struct VolumeView: View {
//
// ContentView.swift
// PickerDemo2
//
// Created by Ray Fix on 1/23/21.
//
import SwiftUI
// A slitghtly silly example of a fixed array prototype
enum SmallArrayEnum<E>: RandomAccessCollection, MutableCollection {
init() {
self = .count0
}
var startIndex: Int { 0 }
var endIndex: Int {
//
// ContentView.swift
// PhotoPicker2
//
// Created by Ray Fix on 10/31/20.
//
import SwiftUI
import PhotosUI
import UIKit
import SwiftUI
import PhotosUI
final class ViewModel: ObservableObject {
@Published var image: UIImage?
}
struct Spinner: UIViewRepresentable {
let isAnimating: Bool