@@ -3,6 +3,7 @@ import { assignColorValue } from "@expo/config-plugins/build/android/Colors";
33import { addImports } from "@expo/config-plugins/build/android/codeMod" ;
44import { mergeContents } from "@expo/config-plugins/build/utils/generateCode" ;
55import path from "path" ;
6+ import semver from "semver" ;
67import { dedent } from "ts-dedent" ;
78import { Manifest } from "." ;
89import { cleanIOSAssets , getExpoConfig , hfs , log } from "./generate" ;
@@ -276,7 +277,7 @@ const withIOSAssets: Expo.ConfigPlugin<Props> = (config, props) =>
276277
277278const withAppDelegate : Expo . ConfigPlugin < Props > = ( config ) =>
278279 Expo . withAppDelegate ( config , ( config ) => {
279- const { modResults } = config ;
280+ const { modResults, sdkVersion = "0.1.0" } = config ;
280281 const { language } = modResults ;
281282
282283 if ( language !== "objc" && language !== "objcpp" && language !== "swift" ) {
@@ -303,18 +304,25 @@ const withAppDelegate: Expo.ConfigPlugin<Props> = (config) =>
303304 offset : swift ? 1 : 0 ,
304305 anchor : swift ? / p u b l i c c l a s s A p p D e l e g a t e : E x p o A p p D e l e g a t e { / : / @ e n d / ,
305306 newSrc : swift
306- ? dedent `
307- override func customize(_ rootView: RCTRootView!) {
308- super.customize(rootView)
309- RNBootSplash.initWithStoryboard("BootSplash", rootView: rootView)
310- }
311- `
307+ ? semver . major ( sdkVersion ) >= 53
308+ ? dedent `
309+ public override func customize(_ rootView: RCTRootView) {
310+ super.customize(rootView)
311+ RNBootSplash.initWithStoryboard("BootSplash", rootView: rootView)
312+ }
313+ `
314+ : dedent `
315+ override func customize(_ rootView: RCTRootView!) {
316+ super.customize(rootView)
317+ RNBootSplash.initWithStoryboard("BootSplash", rootView: rootView)
318+ }
319+ `
312320 : dedent `
313- - (void)customizeRootView:(RCTRootView *)rootView {
314- [super customizeRootView:rootView];
315- [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];
316- }
317- ` ,
321+ - (void)customizeRootView:(RCTRootView *)rootView {
322+ [super customizeRootView:rootView];
323+ [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];
324+ }
325+ ` ,
318326 } ) ;
319327
320328 return {
0 commit comments