add macOS deps to shared libraries

Summary: Add macOS dependencies and alternative classes to the libraries that FlipperKitLayoutPlugin needs to function.

Reviewed By: priteshrnandgaonkar

Differential Revision: D27328277

fbshipit-source-id: f22d1e9f6a5415cee0bae8eaada653be5f5467b3
This commit is contained in:
Kyle Cui
2021-03-29 16:11:32 -07:00
committed by Facebook GitHub Bot
parent ec603255fe
commit 7c44d4d4f0
24 changed files with 444 additions and 5 deletions

View File

@@ -5,14 +5,32 @@
* LICENSE file in the root directory of this source tree.
*/
#import <TargetConditionals.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
#endif
@interface SKHighlightOverlay : NSObject
+ (instancetype)sharedInstance;
+ (UIColor*)overlayColor;
#if TARGET_OS_IPHONE
+ (UIColor*)overlayColor;
- (void)mountInView:(UIView*)view withFrame:(CGRect)frame;
#elif TARGET_OS_OSX
+ (NSColor*)overlayColor;
- (void)mountInView:(NSView*)view withFrame:(CGRect)frame;
#endif
- (void)unmount;
@end

View File

@@ -31,6 +31,8 @@
return self;
}
#if TARGET_OS_IPHONE
- (void)mountInView:(UIView*)view withFrame:(CGRect)frame {
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
@@ -40,10 +42,25 @@
[CATransaction commit];
}
#elif TARGET_OS_OSX
- (void)mountInView:(NSView*)view withFrame:(CGRect)frame {
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
forKey:kCATransactionDisableActions];
_overlayLayer.frame = frame;
[view.layer addSublayer:_overlayLayer];
[CATransaction commit];
}
#endif
- (void)unmount {
[_overlayLayer removeFromSuperlayer];
}
#if TARGET_OS_IPHONE
+ (UIColor*)overlayColor {
return [UIColor colorWithRed:136.0 / 255.0
green:117.0 / 255.0
@@ -51,6 +68,17 @@
alpha:0.6];
}
#elif TARGET_OS_OSX
+ (NSColor*)overlayColor {
return [NSColor colorWithRed:136.0 / 255.0
green:117.0 / 255.0
blue:197.0 / 255.0
alpha:0.6];
}
#endif
@end
#endif