Description
Short description of the issue:
Release builds of RxSwift (and other targets) emit many warnings that various references to Foundation types, such as Foundation.Date
and Dispatch.DispatchTimeInterval
, cannot be used because their definition was never imported, and that this warning will be a hard error in Swift 6.
Example from Timeout.swift:
'RxTimeInterval' aliases 'Dispatch.DispatchTimeInterval' and cannot be used here because 'Dispatch' was not imported by this file; this is an error in Swift 6
Expected outcome:
Warnings against using types which have not been imported by the current file should not appear during Xcode archive build.
What actually happens:
Such warnings do appear.
Self contained code example that reproduces the issue:
The easiest way to reproduce is to:
- Clone the repo
- Open Xcode
- Open Rx.xcworkspace
- Select the RxSwift scheme
- Select an iOS simulator
- Choose Product -> Build For -> Profiling -- or hit Command-Shift-I (that's "eye" not "el")
You'll see a bunch of warnings like the ones described above.
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
Confirmed with 6.6.0 tag as well as the current tip of main
branch, which is 214f7ff.
Platform/Environment
- [ X] iOS
- macOS
- tvOS
- watchOS
- playgrounds
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
- [ X] easy, 100% repro
- sometimes, 10%-100%
- hard, 2% - 10%
- extremely hard, %0 - 2%
Xcode version:
15.0.1
Installation method:
- CocoaPods
- Carthage
- [X ] Git submodules
I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)
- yes (which ones)
- [ X] no
Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)
- just starting
- I have a small code base
- [X ] I have a significant code base
I'm building under macOS Sonoma 14.1.1 on a 2021 M1 Max macbook pro, with Xcode 15.0.1.
These warnings can be resolved by adding "import Foundation" (or similar) to most of the files in question.