File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export function swiftFileUpdater(
5959 originalContents : string ,
6060 sdkVersion ?: string
6161) : string {
62- const methodPrefix = ! sdkVersion ?. includes ( '53' ) ? 'override' : '' ;
62+ const methodPrefix = computeMethodPrefix ( sdkVersion ) ;
6363 const supportedInterfaceOrientationsForCodeBlock = `\n ${ methodPrefix } func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
6464 return OrientationDirector.getSupportedInterfaceOrientationsForWindow()
6565 }\n` ;
@@ -77,6 +77,24 @@ export function swiftFileUpdater(
7777 } ) ;
7878
7979 return results . contents ;
80+
81+ function computeMethodPrefix ( _sdkVersion ?: string ) {
82+ if ( ! _sdkVersion ) {
83+ return '' ;
84+ }
85+
86+ const sdkVersionAsNumber = Number ( _sdkVersion ) ;
87+ if ( Number . isNaN ( sdkVersionAsNumber ) ) {
88+ return '' ;
89+ }
90+
91+ if ( sdkVersionAsNumber >= 53 ) {
92+ return '' ;
93+ }
94+
95+ // Older SDK versions need the override keyword
96+ return 'override' ;
97+ }
8098}
8199
82100export function objCFileUpdater ( originalContents : string ) : string {
You can’t perform that action at this time.
0 commit comments