Xcode 10.2 with Swift 5.0 compiler - protocol inheritance issue

You may be running into https://bugs.swift.org/browse/SR-10257 in the Swift 5.0 compiler. This would happen if you have at least three files:

  1. BasicViewController.swift
  2. SomeOtherFile.swift
  3. ExampleViewController.swift

If SomeOtherFile.swift makes any calls to an AnyObject-typed value, you're compiling in wholemodule mode, and the files are passed to the compiler in the above order (with SomeOtherFile.swift in the middle of the two), then it seems that the compiler fails to properly infer @objc-ness for the implementation of func tableView(_:, didSelectRowAt:). You can work around it by explicitly tagging it with @objc for now.


I ran into the same issue. I fixed it by adding the methods directly in my main class, and override them in the other classes. Now everything gets called correctly.