제 3 자 SwiftAlertView 클래스 (https://github.com/dinhquan/SwiftAlertView)를 사용하고 Swift를 2.3에서 3으로 업데이트합니다.
내가이를 준수하면 다음과 같은 오류 메시지가 나타납니다.iOS - Swift 3 - SwiftAlertView - optional type
Binary operator '+' cannot be applied to operands of type 'Double' and 'Double!'
코드는 다음과 같습니다.
titleTopMargin 및 titleToMessageSpacing은 Double입니다!
Double (titleLabel.frame.size.height)을 추가 할 수 없습니다.
let topPartHeight = (contentView == nil) ? (titleTopMargin + Double(titleLabel.frame.size.height) + titleToMessageSpacing + Double(messageLabel.frame.size.height) + messageBottomMargin) : Double(contentView!.frame.size.height)
정의는 다음과 같습니다.
// customize the margin & spacing of title & message
open var titleSideMargin: Double! // default is 20 px
open var messageSideMargin: Double! // default is 20 px
open var titleTopMargin: Double! // default is 20 px
open var messageBottomMargin: Double! // default is 20 px
open var titleToMessageSpacing: Double! // default is 10 px
어떻게 문제를 해결할 수 있습니까?
감사합니다.
'titleTopMargin','titleToMessageSpacing' 및'messageBottomMargin'을 어디에 정의했는지 보여줄 수 있습니까? 문제 중 하나 (또는 그 이상)가 암시 적으로 언 래핑 될 가능성이 큽니다. –
문제는 http://stackoverflow.com/questions/39251005/strange-generic-function-appear-in-view-controller-after-converting-to-swift-3 – vadian
'open var titleSideMargin : Double = 20.0과 관련이 있습니다. ' –