slidenumber: true autoscale: true
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
func longlongAsyncFunction() async { | |
let id = UUID() | |
print("\(id): start") | |
do { | |
try await withTaskCancellationHandler { | |
try await Task.sleep(nanoseconds: 1000 * 1000 * 1000 * 10) | |
print("\(id): end") | |
} onCancel: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Combine | |
public func async<T>(_ body: @escaping (Yield<T>) throws -> ()) -> Async<T> { | |
Async(body: body) | |
} | |
public func await<P>(_ publisher: P) throws -> P.Output where P: Publisher { | |
try publisher.await() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "Running pre-commit..." | |
# pre-commit自体が最新かどうかをチェック | |
PRECOMMIT_MASTER_FILE='./script/pre-commit' | |
if [ -e $PRECOMMIT_MASTER_FILE ]; then | |
diff -s $PRECOMMIT_MASTER_FILE ./.git/hooks/pre-commit > /dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
cp $PRECOMMIT_MASTER_FILE ./.git/hooks/pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This sample works on Swift4.2 and Swift5! | |
// Let's try to execute this sample with Playground! | |
import Foundation | |
// - MARK: Artificially RxSwift classes | |
public enum Rx { | |
public final class Observable<E> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
typealias Constraint = (UIView, UIView) -> NSLayoutConstraint | |
func equal<L, Axis>(_ to: KeyPath<UIView, L>, constant: CGFloat = 0) -> Constraint where L: NSLayoutAnchor<Axis> { | |
return equal(to, to, constant: constant) | |
} | |
func equal<L, Axis>(_ from: KeyPath<UIView, L>, _ to: KeyPath<UIView, L>, constant: CGFloat = 0) -> Constraint where L: NSLayoutAnchor<Axis> { | |
return { view1, view2 in |
NewerOlder