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 | |
enum Mocks {} | |
extension Mocks { enum Counter {} } | |
extension Mocks.Counter { | |
enum State: Sendable { | |
case start |
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 | |
import Foundation | |
struct PageView<Page, PageContent: View>: View where | |
Page: Identifiable, | |
PageContent: Identifiable, | |
PageContent.ID == Page.ID | |
{ | |
let uiViewControllerRepresentable: PageViewController<Page, PageContent> | |
@Binding var currentPage: Page |
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 | |
/// A `Store` is a non-failing Publisher whose output carries values of type `State`. | |
public final class Store<State, Event, Scheduler: Combine.Scheduler>: Publisher { | |
public typealias Output = State | |
public typealias Failure = Never | |
public typealias Events = AnyPublisher<Event, Never> | |
private let state: CurrentValueSubject<State, Never> | |
private var machine: Cancellable! |
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 | |
// Demonstrates issue when assigning `@State` values in the initialiser | |
struct ContentView: View { | |
@State var string: String = "Initial" // default initialise the value | |
init(string: String) { | |
self.string = string // assign it again with value `string` | |
// We expect that `self.string` has been assigned the value `string`. |
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
// | |
// TaskQueue.swift | |
// | |
// Copyright © 2017 Andreas Grosam. All rights reserved. | |
// | |
import Dispatch | |
/** |
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 | |
func test(completion: (Int) -> ()) { | |
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) | |
//let queue = dispatch_queue_create("serial queue", DISPATCH_QUEUE_SERIAL) | |
var counter = 0 | |
let grp = dispatch_group_create() | |
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
// | |
// RXTimer.h | |
// | |
// Copyright 2013 Andreas Grosam | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 |
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
// | |
// RXAsynchronousOperation.h | |
// | |
// Copyright 2013 Andreas Grosam | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 |
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
/** | |
Objective: | |
Asynchronously transform or process an array of items - one after the | |
other and return the result of each transform in an array. | |
Synopsis: | |
void transform_each(NSArray* inArray, unary_async_t task, completion_t completion); | |
NewerOlder