1 | /*
|
2 | * Copyright (c) Facebook, Inc. and its affiliates.
|
3 | *
|
4 | * This source code is licensed under the MIT license found in the
|
5 | * LICENSE file in the root directory of this source tree.
|
6 | */
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | NS_ASSUME_NONNULL_BEGIN
|
13 |
|
14 | @class RCTFabricSurface;
|
15 |
|
16 | typedef void (^RCTSurfaceEnumeratorBlock)(NSEnumerator<RCTFabricSurface *> *enumerator);
|
17 |
|
18 | /**
|
19 | * Registry of Surfaces.
|
20 | * Incapsulates storing Surface objects and querying them by root tag.
|
21 | * All methods of the registry are thread-safe.
|
22 | * The registry stores Surface objects as weak references.
|
23 | */
|
24 | @interface RCTSurfaceRegistry : NSObject
|
25 |
|
26 | - (void)enumerateWithBlock:(RCTSurfaceEnumeratorBlock)block;
|
27 |
|
28 | /**
|
29 | * Adds Surface object into the registry.
|
30 | * The registry does not retain Surface references.
|
31 | */
|
32 | - (void)registerSurface:(RCTFabricSurface *)surface;
|
33 |
|
34 | /**
|
35 | * Removes Surface object from the registry.
|
36 | */
|
37 | - (void)unregisterSurface:(RCTFabricSurface *)surface;
|
38 |
|
39 | /**
|
40 | * Returns stored Surface object by given root tag.
|
41 | * If the registry does not have such Surface registered, returns `nil`.
|
42 | */
|
43 | - (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
|
44 |
|
45 | @end
|
46 |
|
47 | NS_ASSUME_NONNULL_END
|