Skip to content

Instantly share code, notes, and snippets.

View YOCKOW's full-sized avatar
🍤

YOCKOW YOCKOW

🍤
View GitHub Profile
@YOCKOW
YOCKOW / parameterized-protocol.swift
Last active February 27, 2026 03:57
How deeply will the compiler infer the types behind parameterized protocols?
// Thread: https://forums.swift.org/t/how-deeply-will-the-compiler-infer-the-types-behind-parameterized-protocols/85038
/*
**Base Protocols**
Here are two protocols: `P` and `Q`.
`Q` inherits from `P` and has an additional `associatedtype`.
*/
@YOCKOW
YOCKOW / iana-charset-names-to-swift.py
Created September 26, 2025 07:09
Sample script for SF-0033.
#!/usr/bin/python3
import re
from typing import List, Optional
import urllib.request as request
import xml.etree.ElementTree as ElemTree
REQUIRED_CHARSET_NAMES: List[str] = [
"UTF-8",
"US-ASCII",
@YOCKOW
YOCKOW / CFStringEncoding-NSStringEncoding_CorrespondenceTable.md
Last active August 11, 2025 01:06
Correspondence table: CFStringEncoding ↔︎ NSStringEncoding

Correspondence table: CFStringEncoding ↔︎ NSStringEncoding

C Identifier CF Value NS Value IANA Character Set Name
kCFStringEncodingASCII 0x00000600 0x00000001 us-ascii
kCFStringEncodingNextStepLatin 0x00000b01 0x00000002 x-nextstep
kCFStringEncodingEUC_JP 0x00000920 0x00000003 euc-jp
kCFStringEncodingUTF8 0x08000100 0x00000004 utf-8
kCFStringEncodingISOLatin1 0x00000201 0x00000005 iso-8859-1
kCFStringEncodingMacSymbol 0x00000021 0x00000006 x-mac-symbol

ByteOrder type

Introduction

“How do you describe endianness (or byte-order) as a type in your code?”

This proposal is a simple answer to that simple question.

You may often take byte-order into account when you get involved in, for example, stream programming. While network byte-order is defined as big endian, you may have to handle some other stream whose endian is unknown in advance. In such case, you want a type that identifies endianness to write code like let thatEndian = ByteOrder.littleEndian.

This file has been truncated, but you can view the full file.
root@b6ea2efd971e:/Repositories/SwiftNetworkGear# env YOCKOW_USE_LOCAL_PACKAGES=1 swift test --build-path $HOME/.yswift-build-linux -v
/usr/bin/swiftc -print-target-info
/usr/bin/swiftc -print-target-info
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -emit-supported-features /tmp/TemporaryDirectory.gYAyEF/dummyInput-1.swift
Running resolver because the following dependencies were added: '/Repositories/SwiftRanges', '/Repositories/SwiftPublicSuffix', '/Repositories/SwiftBonaFideCharacterSet', '/Repositories/SwiftBootstring', '/Repositories/ySwiftExtensions', '/Repositories/SwiftUnicodeSupplement'
/usr/bin/clang -target x86_64-unknown-linux-gnu -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=_cUnicodeSupplement -I /Repositories/SwiftUnicodeSupplement/Sources/_cUnicodeSupplement/include -fmodules-cache-path=/root/.yswift-build-linux/x86_64-unknown-linux-gnu/debug/ModuleCache -MD -MT dependencie
# Expected to be used on your own forked repository from 'apple/swift'.
name: CI
on:
push:
branches:
- '**'
tags:
- '!**'
jobs:
test:
@YOCKOW
YOCKOW / Photos-SetLoc.scpt
Last active February 1, 2021 08:13
Workaround for a bug of Photos App about setting location.
(*
Workaround for a bug of Photos App about setting location.
Original thread:
"when I enter a location for a picture, Photos changes it to a different location"
https://discussions.apple.com/thread/251905264
See also:
https://discussions.apple.com/thread/251905264?answerId=254499375022#254499375022
https://discussions.apple.com/thread/251905264?answerId=254501019022#254501019022
@YOCKOW
YOCKOW / swift-package-ci.yml
Last active March 5, 2026 15:05
GitHub Actions' Workflow for Swift Package.
name: CI
on:
push:
branches:
- '**'
tags-ignore:
- '**'
paths:
- '**/*.swift'
- '**/*.c'
.DS_Store
._*
/.build
/Packages
/Package.resolved
/*.xcodeproj