From fcd70168f7e34500c929812b12607bb505b4a13a Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Mon, 14 Oct 2024 12:15:35 +0200 Subject: [PATCH] perf: Use `some` instead of `any` for Swift protocols (#215) * perf: Use `some` instead of `any` for Swift protocols * `__implementation` needs to be `any` (opaque) * fix: Type itself should also be `any` * fix: Return type for getter must also be `any` --- packages/nitrogen/src/syntax/swift/SwiftHybridObjectBridge.ts | 2 +- .../nitrogen/generated/ios/swift/HybridBaseSpecCxx.swift | 2 +- .../nitrogen/generated/ios/swift/HybridChildSpecCxx.swift | 2 +- .../generated/ios/swift/HybridImageFactorySpecCxx.swift | 2 +- .../nitrogen/generated/ios/swift/HybridImageSpecCxx.swift | 2 +- .../ios/swift/HybridTestObjectSwiftKotlinSpecCxx.swift | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/nitrogen/src/syntax/swift/SwiftHybridObjectBridge.ts b/packages/nitrogen/src/syntax/swift/SwiftHybridObjectBridge.ts index 6327b710f..417eb576e 100644 --- a/packages/nitrogen/src/syntax/swift/SwiftHybridObjectBridge.ts +++ b/packages/nitrogen/src/syntax/swift/SwiftHybridObjectBridge.ts @@ -83,7 +83,7 @@ ${hasBase ? `public class ${name.HybridTSpecCxx} : ${baseClasses.join(', ')}` : * Create a new \`${name.HybridTSpecCxx}\` that wraps the given \`${name.HybridTSpec}\`. * All properties and methods bridge to C++ types. */ - public init(_ implementation: any ${name.HybridTSpec}) { + public init(_ implementation: some ${name.HybridTSpec}) { self.__implementation = implementation ${hasBase ? 'super.init(implementation)' : '/* no base class */'} } diff --git a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridBaseSpecCxx.swift b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridBaseSpecCxx.swift index cead1403f..470967dd2 100644 --- a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridBaseSpecCxx.swift +++ b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridBaseSpecCxx.swift @@ -42,7 +42,7 @@ public class HybridBaseSpecCxx { * Create a new `HybridBaseSpecCxx` that wraps the given `HybridBaseSpec`. * All properties and methods bridge to C++ types. */ - public init(_ implementation: any HybridBaseSpec) { + public init(_ implementation: some HybridBaseSpec) { self.__implementation = implementation /* no base class */ } diff --git a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridChildSpecCxx.swift b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridChildSpecCxx.swift index 55d79cb8b..0e73433c0 100644 --- a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridChildSpecCxx.swift +++ b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridChildSpecCxx.swift @@ -42,7 +42,7 @@ public class HybridChildSpecCxx : HybridBaseSpecCxx { * Create a new `HybridChildSpecCxx` that wraps the given `HybridChildSpec`. * All properties and methods bridge to C++ types. */ - public init(_ implementation: any HybridChildSpec) { + public init(_ implementation: some HybridChildSpec) { self.__implementation = implementation super.init(implementation) } diff --git a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridImageFactorySpecCxx.swift b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridImageFactorySpecCxx.swift index 934728d55..c2e56f811 100644 --- a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridImageFactorySpecCxx.swift +++ b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridImageFactorySpecCxx.swift @@ -42,7 +42,7 @@ public class HybridImageFactorySpecCxx { * Create a new `HybridImageFactorySpecCxx` that wraps the given `HybridImageFactorySpec`. * All properties and methods bridge to C++ types. */ - public init(_ implementation: any HybridImageFactorySpec) { + public init(_ implementation: some HybridImageFactorySpec) { self.__implementation = implementation /* no base class */ } diff --git a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridImageSpecCxx.swift b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridImageSpecCxx.swift index 2480d68e4..4a564e416 100644 --- a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridImageSpecCxx.swift +++ b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridImageSpecCxx.swift @@ -42,7 +42,7 @@ public class HybridImageSpecCxx { * Create a new `HybridImageSpecCxx` that wraps the given `HybridImageSpec`. * All properties and methods bridge to C++ types. */ - public init(_ implementation: any HybridImageSpec) { + public init(_ implementation: some HybridImageSpec) { self.__implementation = implementation /* no base class */ } diff --git a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpecCxx.swift b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpecCxx.swift index c6577ad0c..ffa3bd64e 100644 --- a/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpecCxx.swift +++ b/packages/react-native-nitro-image/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpecCxx.swift @@ -42,7 +42,7 @@ public class HybridTestObjectSwiftKotlinSpecCxx { * Create a new `HybridTestObjectSwiftKotlinSpecCxx` that wraps the given `HybridTestObjectSwiftKotlinSpec`. * All properties and methods bridge to C++ types. */ - public init(_ implementation: any HybridTestObjectSwiftKotlinSpec) { + public init(_ implementation: some HybridTestObjectSwiftKotlinSpec) { self.__implementation = implementation /* no base class */ }