Skip to content

Instantly share code, notes, and snippets.

View muukii's full-sized avatar
✈️
We live in a twilight world.

Hiroshi Kimura muukii

✈️
We live in a twilight world.
View GitHub Profile
//
import AsyncDisplayKit
import Foundation
import KeyboardGuide
import AppFoundation
/**
A sub-class of ASCollectionNode that supports handling the height of the Keyboard.
Using `KeyboardGuide`, it changes its contentInset and scroll-indicator regarding the relative height of the Keyboard.
open class ZStackView: UIView {
public init(views: [UIView]) {
super.init(frame: .zero)
views.forEach { view in
addSubview(view)
view.translatesAutoresizingMaskIntoConstraints = false
//
import Foundation
public final class InputFilter {
private final class Storage<T> {
let lock = NSLock()
//: [Previous](@previous)
import Foundation
final class FilterStorage {
private var storage: [String: Any] = [:]
func comparer<T>(for key: String) -> ((T) -> Bool)? {
guard let object = storage[key] else {
extension CGImage {
enum Flipping {
case vertically
case horizontally
}
func rotated(angle: CGFloat, flipping: Flipping? = nil) throws -> CGImage
{
guard angle != 0 else {
{"v":"5.6.5","fr":29.9700012207031,"ip":0,"op":39.0000015885026,"w":253,"h":194,"nm":"baloon_free","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"レイヤー 1/baloon_freeアウトライン 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":1,"s":[0]},{"t":11.0000004480392,"s":[100]}],"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[-6]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":14,"s":[2]},{"t":30.0000012219251,"s":[0]}],"ix":10},"p":{"a":0,"k":[72.61,180.651,0],"ix":2},"a":{"a":0,"k":[43.67,131.788,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":10,"s":[89,89,100]},{"i":{"x":[0.833,0.833,0.833],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":16,"s":[131,131,100]},{"i":{"x":[0.833,0.833,0.833],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":20,"s":[119,119,100]},{"i":{"x":[0.833,0.833,0.833],"y":[1,1,1]},"o":{"x":[0.167,0.167
@muukii
muukii / Store.swift
Last active November 28, 2020 09:02
final class StoreA: Store<StateA, Never> {
}
struct StateB: Equatable {
// Changesに包まれたままStateBに埋め込むとStateAの暗黙のコピーが発生しないのでパフォーマンスに優しいです。
var stateA: Changes<StateA>
prefix operator ‼️
prefix public func ‼️(a: Bool) -> Bool {
return a
}
class MyView: UIView {
init(ageDerived: Derived<Int>) {
...
}
}
// 1: UIコンポーネントが持つ値と比較する
store.subscribeState { (state: State) in
if nameLabel.text != state.name {
nameLabel.text = state.name
}
if ageLabel.text != "\(state.age)" {
ageLabel.text = "\(state.age)"
}
}