Repository: react-native
Issue: Creating a module with New Architecture and including a .swift file introduces compiler errors
Labels: Needs: Repro,Newer Patch Available,Type: New Architecture

### Description

I'm upgrading one of our open-source libraries, which uses Swift for the logic. However, when I include `swift` in the podspec `source_files`, I get compiler errors. 

### Steps to reproduce

I'm running into compiler errors after updating the podspec for the module to include `.swift` files in the `ios/` directory.
```ruby
 s.source_files = "ios/**/*.{h,m,mm,cpp,swift}" <--- adding Swift
 ```
After building the development pod, I get this error:
<img width="1005" alt="Screenshot 2024-08-26 at 10 11 15 AM" src="https://github.com/user-attachments/assets/8c5a6b00-d708-4738-bef8-0bca0512cd43">


I found a workaround by omitting the following:
1.
```ruby
 s.source_files = "ios/**/*.{h,m,mm,cpp}" <--- remove swift
 ```
 
 2. `run bundle exec pod install`
 
 3. Add the `.swift` file manually
<img width="411" alt="Screenshot 2024-08-26 at 10 18 12 AM" src="https://github.com/user-attachments/assets/ae120f81-bd51-4a72-aad9-63f44bb497d4">

After building the project, there is no compiler error. This is fine for testing, but I need to update the podspec to include the file in the `Compile Sources`, otherwise, other errors will occur.

### React Native Version

0.74.0

### Affected Platforms

Runtime - iOS

### Areas

TurboModule - The New Native Module System

### Output of `npx react-native info`

```text
System:
  OS: macOS 14.4.1
  CPU: (8) arm64 Apple M1
  Memory: 175.06 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.0
    path: ~/.nvm/versions/node/v18.18.0/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.0/bin/npm
  Watchman:
    version: 2024.04.15.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/gary/.rvm/gems/ruby-2.7.5/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK:
    API Levels:
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 32.1.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-32 | Google APIs ARM 64 v8a
      - android-32 | Google Play ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-Tiramisu | Google APIs ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11668458
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/gary/.rvm/rubies/ruby-2.7.5/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.2
    wanted: 0.75.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
```


### Stacktrace or Logs

```text
n/a
```


### Reproducer

https://github.com/candlefinance/oss/tree/feat-convert-send-na

### Screenshots and Videos

_No response_