Unknown type name 'import'
Open
Nobody has claimed this yet.
Issue: Author Provided Repro
Needs: Attention
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Description
After switching to AppDelegate.swift xcode started giving this error
Steps to reproduce
- Update rn version from 0.76 to 0.77/0.78
- Update AppDelegate.mm file to AppDelegate.swift
- Delete main.m and AppDelegate.h
- build via xcode
React Native Version
0.78.0
Affected Platforms
Build - MacOS
Output of npx @react-native-community/cli info
System:
OS: macOS 15.2
CPU: (8) arm64 Apple M1
Memory: 89.20 MB / 8.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: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 9.8.1
path: ~/.nvm/versions/node/v18.18.0/bin/npm
Watchman:
version: 4.7.0
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7583922
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.1
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.0.1
wanted: 15.0.1
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.78.0
wanted: 0.78.0
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Stacktrace or Logs
AppDelegate.swift:1:1: error: unknown type name 'import'
1 | import UIKit
AppDelegate.swift:1:13: error: expected ';' after top level declarator
1 | import UIKit
Reproducer
Screenshots and Videos
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproducer and the AppDelegate.swift migration, then compare it with the removed AppDelegate.mm, main.m, and AppDelegate.h files. Build the project through Xcode and trace why the Swift file is being parsed as another source type; done means the React Native 0.78 project builds without the reported errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native, swift
- Domain
- build-system, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100