GRPC Objective-C  1.71.0
GRXWriteable.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #import <Foundation/Foundation.h>
20 
25 @protocol GRXWriteable <NSObject>
26 
28 - (void)writeValue:(id)value;
29 
35 - (void)writesFinishedWithError:(NSError *)errorOrNil;
36 @end
37 
38 typedef void (^GRXValueHandler)(id value);
39 typedef void (^GRXCompletionHandler)(NSError *errorOrNil);
40 typedef void (^GRXSingleHandler)(id value, NSError *errorOrNil);
41 typedef void (^GRXEventHandler)(BOOL done, id value, NSError *error);
42 
47 @interface GRXWriteable : NSObject <GRXWriteable>
48 
49 + (instancetype)writeableWithSingleHandler:(GRXSingleHandler)handler;
50 + (instancetype)writeableWithEventHandler:(GRXEventHandler)handler;
51 
52 - (instancetype)initWithValueHandler:(GRXValueHandler)valueHandler
53  completionHandler:(GRXCompletionHandler)completionHandler
54  NS_DESIGNATED_INITIALIZER;
55 @end
GRXEventHandler
void(^ GRXEventHandler)(BOOL done, id value, NSError *error)
Definition: GRXWriteable.h:41
GRXWriteable-p
A GRXWriteable is an object to which a sequence of values can be sent.
Definition: GRXWriteable.h:25
GRXCompletionHandler
void(^ GRXCompletionHandler)(NSError *errorOrNil)
Definition: GRXWriteable.h:39
GRXValueHandler
void(^ GRXValueHandler)(id value)
Definition: GRXWriteable.h:38
GRXSingleHandler
void(^ GRXSingleHandler)(id value, NSError *errorOrNil)
Definition: GRXWriteable.h:40
GRXWriteable
Utility to create objects that conform to the GRXWriteable protocol, from blocks that handle each of ...
Definition: GRXWriteable.h:47