2019-10-16 20:03:47 +03:00
|
|
|
/*
|
2018-09-12 01:27:47 +03:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2018-04-11 02:37:04 +03:00
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
#import <React/RCTPrimitives.h>
|
2018-04-11 02:37:04 +03:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
@class RCTFabricSurface;
|
2018-04-11 02:37:04 +03:00
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
typedef void (^RCTSurfaceEnumeratorBlock)(NSEnumerator<RCTFabricSurface *> *enumerator);
|
2019-03-22 09:34:14 +03:00
|
|
|
|
2018-04-11 02:37:04 +03:00
|
|
|
/**
|
|
|
|
* Registry of Surfaces.
|
2019-07-20 20:36:52 +03:00
|
|
|
* Incapsulates storing Surface objects and querying them by root tag.
|
2018-04-11 02:37:04 +03:00
|
|
|
* All methods of the registry are thread-safe.
|
2019-07-20 20:36:52 +03:00
|
|
|
* The registry stores Surface objects as weak references.
|
2018-04-11 02:37:04 +03:00
|
|
|
*/
|
2019-08-08 17:13:22 +03:00
|
|
|
@interface RCTSurfaceRegistry : NSObject
|
2018-04-11 02:37:04 +03:00
|
|
|
|
2019-03-22 09:34:14 +03:00
|
|
|
- (void)enumerateWithBlock:(RCTSurfaceEnumeratorBlock)block;
|
2018-09-26 20:01:36 +03:00
|
|
|
|
2018-04-11 02:37:04 +03:00
|
|
|
/**
|
|
|
|
* Adds Surface object into the registry.
|
|
|
|
* The registry does not retain Surface references.
|
|
|
|
*/
|
2019-08-08 17:13:22 +03:00
|
|
|
- (void)registerSurface:(RCTFabricSurface *)surface;
|
2018-04-11 02:37:04 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes Surface object from the registry.
|
|
|
|
*/
|
2019-08-08 17:13:22 +03:00
|
|
|
- (void)unregisterSurface:(RCTFabricSurface *)surface;
|
2018-04-11 02:37:04 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns stored Surface object by given root tag.
|
2019-07-20 20:36:52 +03:00
|
|
|
* If the registry does not have such Surface registered, returns `nil`.
|
2018-04-11 02:37:04 +03:00
|
|
|
*/
|
2019-08-08 17:13:22 +03:00
|
|
|
- (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
|
2018-04-11 02:37:04 +03:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|