(via ChatGPT)
- Existential type: Can hold a value of any type that conforms to the protocol.
- Requires heap allocation (boxing).
- Uses dynamic dispatch via a witness table.
(via ChatGPT)
Modern OSes like macOS, Linux, Windows, and iOS have built-in support for networking features that make tools like WireGuard and Tailscale work smoothly:
| Feature | Description | Used By |
Using sending
tells the compiler:
In the code below, it enforces running the operation once. Using it in the 2nd Task causes a compiler error.
import Foundation | |
let fizzValue = "Fizz" | |
let buzzValue = "Buzz" | |
let fizzBuzzValue = "FizzBuzz" | |
let emptyValue = "" | |
enum FizzBuzz: String { | |
case fizz = "Fizz" | |
case buzz = "Buzz" |
(via ChatGPT)
Swift provides powerful collection types, with Array and Sequence being fundamental. This document explores their differences, best practices, and common pitfalls, including Copy-on-Write (CoW), stride
, and Lazy Sequences.
(via ChatGPT)
Below is a step-by-step guide for wiring a KY-040 rotary encoder to an ESP32-C3-based board on a breadboard, along with a simple example sketch (Arduino-style) showing how to read both rotation and the built-in push button.
The tradition of writing Q.E.D. ("quod erat demonstrandum") at the end of a mathematical proof is the culmination of a long intellectual lineage that began with Pythagoras, evolved through Plato, Aristotle, Euclid, and Archimedes, and ultimately shaped the foundations of logical demonstration in mathematics. Each thinker built upon the ideas of their predecessors, refining the principles of proof, logic, and rigor that remain central to mathematics today.
Pythagoras and his followers were among the first to view mathematics as a philosophical pursuit, believing that numbers and geometric relationships governed the universe. They sought logical justification for mathematical truths, leading to the earliest systematic proofs in history. The Pythagorean Theorem exemplifies their approach, demonstrating how mathematical relationships could be established through reasoning rather than empirical observation. However
Automated tests with actors can result in using await
across many lines which is a lot of lock/unlock cycles which can have some unwanted side effects. In the very least it can just make your unit tests run more slowly. I wanted to see how I could set up my tests to evaluation expectations within the isolated actor scope. I found I could use an isolated parameter with a block to do it. See the code snippet for the function below.
private func run(_ actorInstance: <#actor type#>,
block: @Sendable (isolated <#actor type#>) async -> Void) async {
await block(actorInstance)
}