This file contains hidden or 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
public protocol Pointer<Pointee>: ~Copyable { | |
associatedtype Pointee | |
var pointee: Pointee { get nonmutating set } | |
} | |
public struct UniquePointer<Pointee>: ~Copyable, Pointer { | |
private let memory: UnsafeMutablePointer<Pointee> | |
public var pointee: Pointee { | |
get { memory.pointee } |
This file contains hidden or 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
// A reference type Set | |
private final class ReferenceSet<Element: Hashable>: Hashable, Collection { | |
typealias Element = Element | |
typealias Iterator = Set<Element>.Iterator | |
typealias Index = Set<Element>.Index | |
typealias Indices = Set<Element>.Indices | |
typealias SubSequence = Set<Element>.SubSequence | |
private var inner = Set<Element>() | |
This file contains hidden or 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
#!/bin/bash | |
# Check if the script received the correct number of arguments | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 <repo_path> <output_file>" | |
exit 1 | |
fi | |
REPO_PATH=$1 | |
OUTPUT_FILE=$2 |
This file contains hidden or 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
#!/bin/zsh | |
# Test if the Swift compiler knows about a particular language feature. | |
# | |
# Usage: | |
# | |
# swift-has-feature [--swift SWIFT_PATH] [--language-version LANGUAGE_VERSION] FEATURE | |
# | |
# The feature should be an upcoming or experimental language feature, | |
# such as `"StrictConcurrency"` or `"ExistentialAny"`. |
This file contains hidden or 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 Observation | |
@Observable | |
final class Signal<T> { | |
var value: T | |
init(value: T) { | |
self.value = value | |
} |
This file contains hidden or 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
// | |
// CDView.swift | |
// CD | |
// | |
// Created by Daniel Kuntz on 7/3/23. | |
// | |
import SwiftUI | |
struct ShapeWithHole: Shape { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
public struct Locked<T>: LockedValue { | |
public init(_ value: T) { | |
let lock = Self.make(for: value) | |
withLock = { act in | |
lock.lock() | |
defer { lock.unlock() } | |
return act(&lock.unsafe_wrapped) | |
} | |
} |
This file contains hidden or 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
extension Collection { | |
func compact<E>() -> [E] where E? == Element { | |
compactMap { $0 } | |
} | |
} | |
extension Collection { |
NewerOlder