I'm experiencing an issue where my app freezes when built with Xcode 16 on iOS 18.
Additional Information:
- The issue does not occur when building the app with Xcode 16 on iOS 17 or lower.
- The issue does not occur when building the app with Xcode 15 on iOS 18.
- The CPU usage spikes to 100% when the app freezes.
- The app specifically freezes after the code runs into .sink(receiveValue:).
Here is the relevant code snippet:
@Published var selectedCardData: CardData?
@Published var selectedRootTab: RootViewTab = .statement
override func load() {
state = .loading
$selectedCardData.ignoreNil()
.removeDuplicates()
.map { [unowned self] cardData in
$selectedRootTab.filter { $0 == .statement }
.first()
.map { _ in cardData }
}
.switchToLatest()
.sink(receiveValue: { value in
print(value) // value not nil
print("Execution reaches this point and the app freezes (CPU 100%).")
})
.store(in: &cancellables)
}
Are there any known changes in iOS 18 or Xcode 16 that might affect this code?