Skip to content

Instantly share code, notes, and snippets.

View kitasuke's full-sized avatar

Yusuke Kita kitasuke

View GitHub Profile
final class Loader: BindableObject {
let didChange = PassthroughSubject<Data?, Never>()
var task: URLSessionDataTask!
var data: Data? = nil {
didSet {
didChange.send(data)
}
}
init(_ url: URL) {
@Kuniwak
Kuniwak / Config.xcconfig
Created February 28, 2019 08:25
Useful xcconfig for SwiftSyntax
CUSTOM_SWIFT_SOURCE = $(SRCROOT)/path/to/swift-source
HEADER_SEARCH_PATHS = $(CUSTOM_SWIFT_SOURCE)/swift/include/swift-c/SyntaxParser
LIBRARY_SEARCH_PATHS = $(CUSTOM_SWIFT_SOURCE)/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib
LD_RUNPATH_SEARCH_PATHS = $(LIBRARY_SEARCH_PATHS)

slidenumber: true

Swiftの関数型の

実行時表現

わいわいswiftc

omochimetaru


protocol Animal {
func foo() -> Int
}
struct Cat: Animal {
var value: Int = 42
func foo() -> Int { return value }
}
func useAnimal(_ animal: Animal) -> Int {
@ukitaka
ukitaka / Eq.sil.swift
Created February 26, 2018 10:51
Eq.sil
*** SIL module before Guaranteed Passes transformation (0) ***
// unwrapByEq(_:)
sil @_T02Eq08unwrapByA0ySiSgF : $@convention(thin) (Optional<Int>) -> () {
// %0 // users: %5, %1
bb0(%0 : $Optional<Int>):
debug_value %0 : $Optional<Int>, let, name "optional", argno 1 // id: %1
// function_ref Bool._getBuiltinLogicValue()
%2 = function_ref @_T0Sb21_getBuiltinLogicValueBi1_yF : $@convention(method) (Bool) -> Builtin.Int1 // user: %17
// function_ref != infix<A>(_:_:)
%3 = function_ref @_T0s2neoiSbxSg_ABts9EquatableRzlF : $@convention(thin) <τ_0_0 where τ_0_0 : Equatable> (@in Optional<τ_0_0>, @in Optional<τ_0_0>) -> Bool // user: %13
@ianpartridge
ianpartridge / swift-linux-testing.md
Created August 9, 2017 13:00
Swift Packages: Linux Compatibility Testing

Swift Packages: Linux Compatibility Testing

As the Swift on Linux and Swift Package Manager ecosystems mature, many authors of Swift packages want to enable their packages on Linux as well as Apple platforms. The growth of Server-Side Swift makes Linux an important target for many packages.

The first step is to run a package's unit tests on Linux, to verify it behaves as expected.

Enabling unit tests on Linux

Because Swift on Linux does not use the Objective-C runtime, the dynamic features that the XCTest unit testing framework uses to automatically discover testcases are not available.

@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would