Skip to content

Commit 5f74945

Browse files
committed
Switch to compatibility_alias for Swift compat
1 parent 8127770 commit 5f74945

13 files changed

Lines changed: 33 additions & 36 deletions

packages/react-native/React/CoreModules/RCTActionSheetManager.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ - (void)presentSharingServicePicker:(NSSharingServicePicker *)picker
339339
});
340340
NSString *userInterfaceStyle = [RCTConvert NSString:options.userInterfaceStyle()];
341341
NSNumber *anchorViewTag = [RCTConvert NSNumber:options.anchor() ? @(*options.anchor()) : nil];
342-
RCTPlatformColor *tintColor = [RCTConvert RCTPlatformColor:options.tintColor() ? @(*options.tintColor()) : nil]; // [macOS]
342+
RCTPlatformColor *tintColor = [RCTConvert UIColor:options.tintColor() ? @(*options.tintColor()) : nil]; // [macOS]
343343

344344
dispatch_async(dispatch_get_main_queue(), ^{
345345
if (message) {

packages/react-native/React/RCTUIKit/RCTPlatformDisplayLink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#if !TARGET_OS_OSX
1313
#import <QuartzCore/CADisplayLink.h>
14-
#define RCTPlatformDisplayLink CADisplayLink
14+
@compatibility_alias RCTPlatformDisplayLink CADisplayLink;
1515
#else
1616

1717
#import <Foundation/Foundation.h>

packages/react-native/React/RCTUIKit/RCTUIActivityIndicatorView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#import <React/RCTUIKitCompat.h>
1515

1616
#if !TARGET_OS_OSX
17-
typedef UIActivityIndicatorView RCTUIActivityIndicatorView;
17+
@compatibility_alias RCTUIActivityIndicatorView UIActivityIndicatorView;
1818
#else
1919
@interface RCTUIActivityIndicatorView : NSProgressIndicator
2020
NS_ASSUME_NONNULL_BEGIN

packages/react-native/React/RCTUIKit/RCTUIImage.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
#if !TARGET_OS_OSX
1717
#import <UIKit/UIKit.h>
18-
#define RCTPlatformImage UIImage
19-
#define RCTUIImage UIImage
18+
@compatibility_alias RCTPlatformImage UIImage;
19+
@compatibility_alias RCTUIImage UIImage;
2020
#else
2121
#import <AppKit/AppKit.h>
22-
#define RCTPlatformImage NSImage
22+
@compatibility_alias RCTPlatformImage NSImage;
2323
#endif
2424

2525
NS_ASSUME_NONNULL_BEGIN

packages/react-native/React/RCTUIKit/RCTUIImageView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#import <React/RCTUIImage.h>
1616

1717
#if !TARGET_OS_OSX
18-
typedef UIImageView RCTUIImageView;
18+
@compatibility_alias RCTUIImageView UIImageView;
1919
#else
2020
@interface RCTUIImageView : NSImageView
2121
NS_ASSUME_NONNULL_BEGIN

packages/react-native/React/RCTUIKit/RCTUIKitCompat.h

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ NS_ASSUME_NONNULL_BEGIN
2222
// MARK: - Color
2323

2424
#if !TARGET_OS_OSX
25-
#define RCTPlatformColor UIColor
25+
@compatibility_alias RCTPlatformColor UIColor;
26+
@compatibility_alias RCTUIColor UIColor;
2627
#else
27-
#define RCTPlatformColor NSColor
28+
@compatibility_alias RCTPlatformColor NSColor;
29+
@compatibility_alias RCTUIColor NSColor;
2830
#endif
2931

30-
// Backward compatibility
31-
#define RCTUIColor RCTPlatformColor
32-
3332
// MARK: - Event types
3433

3534
#if TARGET_OS_OSX
@@ -209,30 +208,28 @@ typedef NS_ENUM(NSInteger, UIActivityIndicatorViewStyle) {
209208
// MARK: - Gesture recognizer
210209

211210
#if !TARGET_OS_OSX
212-
#define RCTPlatformPanGestureRecognizer UIPanGestureRecognizer
211+
@compatibility_alias RCTPlatformPanGestureRecognizer UIPanGestureRecognizer;
212+
@compatibility_alias RCTUIPanGestureRecognizer UIPanGestureRecognizer;
213213
#else
214214
#define UIGestureRecognizer NSGestureRecognizer
215215
#define UIGestureRecognizerDelegate NSGestureRecognizerDelegate
216-
#define RCTPlatformPanGestureRecognizer NSPanGestureRecognizer
217-
#define UIApplication NSApplication
216+
@compatibility_alias RCTPlatformPanGestureRecognizer NSPanGestureRecognizer;
217+
@compatibility_alias RCTUIPanGestureRecognizer NSPanGestureRecognizer;
218+
@compatibility_alias UIApplication NSApplication;
218219
#endif
219220

220-
// Backward compatibility
221-
#define RCTUIPanGestureRecognizer RCTPlatformPanGestureRecognizer
222-
223221
// MARK: - Cross-platform typedefs
224222

225223
#if !TARGET_OS_OSX
226-
typedef UIApplication RCTPlatformApplication;
227-
typedef UIWindow RCTPlatformWindow;
228-
typedef UIViewController RCTPlatformViewController;
224+
@compatibility_alias RCTPlatformApplication UIApplication;
225+
@compatibility_alias RCTPlatformWindow UIWindow;
226+
@compatibility_alias RCTPlatformViewController UIViewController;
227+
@compatibility_alias RCTUIApplication UIApplication;
229228
#else
230-
typedef NSApplication RCTPlatformApplication;
231-
typedef NSWindow RCTPlatformWindow;
232-
typedef NSViewController RCTPlatformViewController;
229+
@compatibility_alias RCTPlatformApplication NSApplication;
230+
@compatibility_alias RCTPlatformWindow NSWindow;
231+
@compatibility_alias RCTPlatformViewController NSViewController;
232+
@compatibility_alias RCTUIApplication NSApplication;
233233
#endif
234234

235-
// Backward compatibility
236-
#define RCTUIApplication RCTPlatformApplication
237-
238235
NS_ASSUME_NONNULL_END

packages/react-native/React/RCTUIKit/RCTUILabel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#import <React/RCTUIKitCompat.h>
1515

1616
#if !TARGET_OS_OSX
17-
typedef UILabel RCTUILabel;
17+
@compatibility_alias RCTUILabel UILabel;
1818
#else
1919
@interface RCTUILabel : NSTextField
2020
NS_ASSUME_NONNULL_BEGIN

packages/react-native/React/RCTUIKit/RCTUIScrollView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#import <UIKit/UIKit.h>
1919

20-
#define RCTUIScrollView UIScrollView
20+
@compatibility_alias RCTUIScrollView UIScrollView;
2121
#define RCTUIScrollViewDelegate UIScrollViewDelegate
2222

2323
#else // TARGET_OS_OSX [

packages/react-native/React/RCTUIKit/RCTUISlider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#import <React/RCTUIKitCompat.h>
1515

1616
#if !TARGET_OS_OSX
17-
typedef UISlider RCTUISlider;
17+
@compatibility_alias RCTUISlider UISlider;
1818
#else
1919
@protocol RCTUISliderDelegate;
2020

packages/react-native/React/RCTUIKit/RCTUISwitch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#import <React/RCTUIKitCompat.h>
1515

1616
#if !TARGET_OS_OSX
17-
typedef UISwitch RCTUISwitch;
17+
@compatibility_alias RCTUISwitch UISwitch;
1818
#else
1919
@interface RCTUISwitch : NSSwitch
2020
NS_ASSUME_NONNULL_BEGIN

0 commit comments

Comments
 (0)