View iosMain_GC.kt
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 } |
View LazyVStackDeinitCheck.swift
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 { |
View PrivateRepositoryVendoredFrameworkTemplate.podspec
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 |
View StateCallAsFunction.swift
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> { |
View propertyWrapperWithAppAndTest.swift
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 |
View UnioSystem.swift
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関連 |
View reversi-ios.pu
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> |
View FlatMapLatestInCombine.swift
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 { |
View DynamicKePathLiteralFunctionExpressions.swift
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 { |
View RuntimeCrashSample.swift
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