Cannot call "..." with an argument list like "..."

This line:

appDelegate.navigationController.pushViewControllerOnTopOfEverything(controller)

      

raises this error:

Cannot invoke 'pushViewControllerOnTopOfEverything' with an argument list of type '(VUPickerController!)'

      

Here's the complete function:

    func onSortTapped() {

    if self.pickerModel == nil {
        self.pickerModel = VUPickerModel.newOrExistingPickerModelForKey(VUPickerModelKeyType.ShowsSort)
    }

    var controller = VUPickerController(model: self.pickerModel) { (selectionChanged) in

        if selectionChanged {
            self.pickerModel?.archiveWithModelKeyType(VUPickerModelKeyType.ShowsSort)

            let userSelections = self.pickerModel!.selectedRows()
            let sectionItem = userSelections![0] as! VUPickerSectionItem
            self.leftGenreBar?.genreName = sectionItem.title
        }
    }

    let appDelegate = UIApplication.sharedApplication().delegate
    appDelegate.navigationController.pushViewControllerOnTopOfEverything(controller)

}

      

navigationController

is the usual UIViewController

, written in Obj-C, and pushViewControllerOnTopOfEverything

is defined as:

- (void)pushViewControllerOnTopOfEverything:(UIViewController *)viewController;

      

It is also VUPickerController

subclassed from UIViewController

.


onSortTapped()

was originally written in Obj-C and I am trying to do a simple translation, but I am missing something.


I tried casting for UIViewController

:

appDelegate.navigationController.pushViewControllerOnTopOfEverything(controller as! UIViewController)

      

but got a similar error:

Cannot invoke 'pushViewControllerOnTopOfEverything' with an argument list of type '(UIViewController)'

      


EDIT

When I try:

po appDelegate.navigationController

      

in the debug console:

error: <EXPR>:1:13: error: type of expression is ambiguous without more context

      

If I just po:

po appDelegate

      

I get:

Printing description of appDelegate:
Optional(<AppDelegate: 0x7f81a2d1cc40>)

      

And it navigationController

is the appDelegate property declared in the Obj-C source file appDelegate.h

.

0


source to share





All Articles