0

Xcode has started displaying a compiler error as soon as I open my project (i.e. a build is not required) but it's all a bit odd. One error is shown in the build time tab but when I open the compiler message window there are three identical errors spread across multiple files. The errors are not highlighted in the editor window so I can't trace them but as they're flagged in files I haven't touched recently I suspected the problem was with Xcode rather than my code.

The error is shown in the build time window as:

Swift Compiler Error - cannot convert value of type '()' to closure result type 'Observable<Void>'

In the messages window:

<unknown>:0: error: cannot convert value of type '()' to closure result type 'Observable<Void>'

These errors are spread across three files in the messages window, all of which use at least one RxSwift dependency (RxDataSources, RxSwift, and RxCocoa) and, as noted above, I haven't touched a couple of them for a week or two and my dependencies have not been recently amended so I can be reasonably certain they are not the issue.

I've done all the usual (clean, clear cache, reboot, checked error display settings, roll back to an earlier version, update dependencies, reinstall Xcode) but the error persists and I'm effectively locked out of further development until I can resolve it. To say that I'm frustrated would be an understatement!

I'm running Xcode 10.2.1 (10E1001) Help!!

AtulParmar
  • 4,358
  • 1
  • 24
  • 45
rustproofFish
  • 931
  • 10
  • 32
  • Did you update Xcode? If so, check you are using the latest carthage (0.33.0). It may have no relation to your issue, but strange compile error in my project was fixed by using latest carghage. – pompopo May 22 '19 at 08:42
  • Everything is using the latest version but I've reinstalled them just on the off-chance. No joy sadly :-( – rustproofFish May 22 '19 at 14:05

1 Answers1

0

I took the app apart and then added in each class individually until the error popped up again. The problem was a typo (syntax error) in a view model struct, specifically, the line:

let editTapped = CocoaAction { return }

which should have been:

let editTapped = CocoaAction {
    // do stuff
    return .empty()
}

I'm guessing the failure of the compiler to highlight the error in the editor pane is a bug so I'll report it (unless anyone has views to the contrary?) as it was very time consuming to sort out. The odd things was that rolling back to a previous working version didn't fix it - I had to delete the entire app and then rebuild it from scratch manually adding the files as I went. Weird...

rustproofFish
  • 931
  • 10
  • 32