RCTWeakProxy.m 546 B

123456789101112131415161718192021222324252627282930
  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. #import "RCTWeakProxy.h"
  8. @implementation RCTWeakProxy
  9. - (instancetype)initWithTarget:(id)target
  10. {
  11. if (self = [super init]) {
  12. _target = target;
  13. }
  14. return self;
  15. }
  16. + (instancetype)weakProxyWithTarget:(id)target
  17. {
  18. return [[RCTWeakProxy alloc] initWithTarget:target];
  19. }
  20. - (id)forwardingTargetForSelector:(SEL)aSelector
  21. {
  22. return _target;
  23. }
  24. @end