PhotoCollectionViewDelegate
具有初始化程序-
-(instancetype)initWithController:(MyViewController *)controller {
self = [super init];
if(self) {
self.myViewController = controller;
}
return self;
}
从
MyViewController.swift
文件调用此文件,let photoCollectionViewDelegate = PhotoCollectionViewDelegate(controller : self)
gives 'Can not convert value of type MyViewController to expected argument type 'MyViewController!'
即
PhotoCollectionViewDelegate(controller : MyViewController!)
,但称之为self
。 最佳答案
这可能很愚蠢,但你有没有试过:let photoCollectionViewDelegate = PhotoCollectionViewDelegate(controller : self as MyViewController!)