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/Foundation.h> | |
#include <dispatch/dispatch.h> | |
@interface Operation : NSOperation | |
@property (nonatomic, readwrite) BOOL isExecuting; | |
@property (nonatomic, readwrite) BOOL isFinished; | |
@property (nonatomic, readwrite) BOOL terminating; | |
@end | |
@implementation Operation { |
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
// | |
// SimpleGetHTTPRequest.h | |
// | |
#import <Foundation/Foundation.h> | |
typedef void (^completionHandler_t) (id result); | |
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); | |
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
// | |
// 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
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
// | |
// 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 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
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! |
OlderNewer