I have a function :
static func create<T>(userId: Int, streamId: Int, isPushStream: Bool = false, delegateToController controller: T? = nil) -> ShowUserInfoVC where T: UIViewController, T: ShowUserInfoVCDelegate {
let showUserInfoVC = ShowUserInfoVC()
showUserInfoVC.modalTransitionStyle = .crossDissolve
showUserInfoVC.modalPresentationStyle = .overCurrentContext
showUserInfoVC.delegate = controller
showUserInfoVC.userId = userId
showUserInfoVC.streamId = streamId
showUserInfoVC.isPushStream = isPushStream
return showUserInfoVC
}
When I call:
let vc = ShowUserInfoVC.create(userId: id, streamId: id)
It says error:
Generic parameter 'T' could not be inferred