-
Swift’s
throw
/try
/catch
is designed for predictable, recoverable errors. -
Swift requires explicit syntax:
func foo() throws
try foo()
-
do { try foo() } catch { ... }
(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:
- This value will be consumed by a concurrent context (e.g., a task).
- It must not be accessed again from the current task.
- If it is accessed again (e.g., reused or mutated), the compiler will raise an error.
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.