Skip to content

Instantly share code, notes, and snippets.

@wvteijlingen
wvteijlingen / WebSocket.swift
Last active November 3, 2025 23:39
Swift WebSocket that uses AsyncThrowingStream
import Foundation
import Combine
public enum WebSocketError: Swift.Error {
case alreadyConnectedOrConnecting
case notConnected
case cannotParseMessage(String)
}
public extension WebSocket {
@wvteijlingen
wvteijlingen / Component.tsx
Created May 7, 2024 09:07
React Native Dark Mode
import useThemedStyles, { createThemedStyleSheet } from "./useThemedStyles"
export default function Component() {
const [styles, colorScheme] = useThemedStyles(stylesheet)
// ...
}
const stylesheet = createThemedStyleSheet((theme) => ({
container: {
backgroundColor: theme.colors.background