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 kotlin.native.internal.GC as internalGC | |
/** | |
* https://github.com/JetBrains/kotlin/blob/1.5.30/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/GC.kt | |
*/ | |
object GC { | |
var threshold: Int | |
get() = internalGC.threshold | |
set(value) { internalGC.threshold = value } |
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 Combine | |
import SwiftUI | |
struct ContentView: View { | |
@ObservedObject var viewModel = ViewModel() | |
var body: some View { | |
Button("Refresh") { viewModel.objectWillChange.send() } | |
ScrollView(.vertical) { | |
LazyVStack { |
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
Pod::Spec.new do |spec| | |
module PrivateRepository | |
class Spec | |
attr_reader :version | |
attr_reader :homepage | |
attr_reader :source | |
def initialize(owner, name, version, source) | |
@version = version | |
@homepage = "https://github.com/#{owner}/#{name}" | |
@source = source |
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
enum _Value<Initial, Changed> { | |
case initial(Initial) | |
case changed(Changed) | |
} | |
typealias StateRepresentable<T> = _Value<T, T> | |
typealias ChangeHandleable<T> = _Value<Void, T> | |
extension _Value where Initial == Void { | |
static func initial() -> _Value<Void, Changed> { |
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
// Playgroundでの実行を想定しているのでCombineを利用 | |
import Combine | |
// MARK: - CombineをRxSwiftのように定義する | |
typealias Observable<T> = AnyPublisher<T, Error> | |
typealias PublishRelay<T> = PassthroughSubject<T, Never> | |
typealias BehaviorRelay<T> = CurrentValueSubject<T, Never> | |
typealias DisposeBag = [AnyCancellable] | |
/// valueのsetterを非公開にしたBehaviorRelay |
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
// Playgroundでの実行を想定しているのでCombineを利用 | |
import Combine | |
// MARK: - CombineをRxSwiftのように定義する | |
typealias Observable<T> = AnyPublisher<T, Error> | |
typealias PublishRelay<T> = PassthroughSubject<T, Never> | |
typealias BehaviorRelay<T> = CurrentValueSubject<T, Never> | |
typealias DisposeBag = [AnyCancellable] | |
// MARK: - Output関連 |
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
@startuml | |
package Reversi.app { | |
class ViewController { | |
~ viewModel: ReversiViewModelType | |
} | |
} | |
package ReversiLogic.framework { | |
class ReversiViewModel { | |
+ input: InputWrapper<ReversiViewModel.Input> |
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 Combine | |
extension Publisher { | |
func flatMapLatest<T: Publisher>(_ transform: @escaping (Output) -> T) -> Publishers.SwitchToLatest<T, Publishers.Map<Self, T>> where T.Failure == Failure { | |
map(transform).switchToLatest() | |
} | |
} | |
enum Pattern { |
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
/// - seealso: https://www.hackingwithswift.com/articles/212/whats-new-in-swift-5-2 | |
import Foundation | |
protocol OptionalType { | |
associatedtype Wrapped | |
var value: Wrapped? { get } | |
} | |
extension Optional: OptionalType { |
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 | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
print(Object1().object) | |
} | |
} |
NewerOlder