We have a big issue with the current Xcode version (10.2).
There is a BasicViewController
class with the following signature:
class Basi
You should attached dataSource
and delegate
both side using Storyboard
and also Class, because once i had the same issue for tableview and it was due to in class i have not done
self.tableView.delegate = self
self.tableView.datasource = self
i think you are not doing like this.
I know that it's not necessary to use both style but some time we need this. have a look on this answer https://stackoverflow.com/a/39443079/3485420
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:
BasicViewController.swift
SomeOtherFile.swift
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.