[英]Contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored
[英]Member 'changeAccountConfirmDialog' expects argument of type 'Author'
internal enum PlayBroadcasterDialogLiveType: Equatable {
case error
case exit
case liveOnOtherDevice
case stopped
case paused
case freezed
case reconnected
case disconnected
case liveIsModerate
case changeAccountConfirmDialog(Author)
internal var shouldExitToLiveReport: Bool {
return self != .liveOnOtherDevice && self != .disconnected && self != .error
&& !isLiveModerate && self != .freezed && self != .changeAccountConfirmDialog
}
}
如果 changeAccountConfirmDialog 中有參數,我應該如何實現這個變量的功能。
我得到的錯誤是“成員'changeAccountConfirmDialog'需要'Author'類型的參數”
您需要將if case...
用於具有關聯值的枚舉案例。
internal var shouldExitToLiveReport: Bool {
if case .changeAccountConfirmDialog = self {
return false
}
return self != .liveOnOtherDevice && self != .disconnected && self != .error
&& !isLiveModerate && self != .freezed
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.