Files
flipper/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin/SKHighlightOverlay.m
Pascal Hartig bbee7a3357 Update iOS license headers (and more)
Summary: Add the affiliates bit that the linter is checking for.

Reviewed By: jknoxville

Differential Revision: D15164826

fbshipit-source-id: 500ffe89ec0c2fd3acfbc374408d16a337cecfa4
2019-05-02 03:28:07 -07:00

55 lines
1.2 KiB
Objective-C

/*
* Copyright (c) 2018-present, Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
#if FB_SONARKIT_ENABLED
#import "SKHighlightOverlay.h"
@implementation SKHighlightOverlay
{
CALayer *_overlayLayer;
}
+ (instancetype)sharedInstance {
static SKHighlightOverlay *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [self new];
});
return sharedInstance;
}
- (instancetype)init {
if (self = [super init]) {
_overlayLayer = [CALayer layer];
_overlayLayer.backgroundColor = [SKHighlightOverlay overlayColor].CGColor;
}
return self;
}
- (void)mountInView:(UIView *)view withFrame:(CGRect)frame {
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
forKey:kCATransactionDisableActions];
_overlayLayer.frame = frame;
[view.layer addSublayer: _overlayLayer];
[CATransaction commit];
}
- (void)unmount {
[_overlayLayer removeFromSuperlayer];
}
+ (UIColor*)overlayColor {
return [UIColor colorWithRed:136.0 / 255.0 green:117.0 / 255.0 blue:197.0 / 255.0 alpha:0.6];
}
@end
#endif