我已經使用Eureka作爲我的表單,但我正面臨一個問題。我安裝使用這些代碼尤里卡:無法轉換'BaseRow'類型的值?指定類型'CustomPushRow?'
form +++ Section("Add Event")
<<< TextRow("Event"){ row in
row.title = "Event"
row.placeholder = "Enter Event Name Here"
}
<<< DateRow("Date"){
$0.title = "Date"
$0.value = selectedDate
}
<<< TimeRow("Time"){
$0.title = "Time"
$0.value = selectedDate
}
let locationSearchTable = storyboard!.instantiateViewController(withIdentifier: "eventLocation") as! EventLocationViewController
form +++ Section("Location")
<<< CustomPushRow<EventLocationViewController>(){
$0.title = "Location"
$0.presentationMode = .segueName(segueName: "eventLocation" ,controllerProvider: locationSearchTable, onDismiss: nil)
}
這裏自定義推行類的形式
public final class CustomPushRow<T: Equatable>: SelectorRow<PushSelectorCell<T>, SelectorViewController<T>>, RowType {
public required init(tag: String?) {
super.init(tag: tag)
presentationMode = .show(controllerProvider: ControllerProvider.callback {
return SelectorViewController<T>(){ _ in }
}, onDismiss: { vc in
print("On Dimiss")
_ = vc.navigationController?.popViewController(animated: true)
})
}
}
,當我想改變我用表格的值,此方法來改變
let eventName : TextRow? = form.rowBy(tag:"Event")
eventName?.value = "asdasadsds"
但是當我想更改自定義推送行時,我遇到此問題無法轉換類型'BaseRow?'的值?指定類型'CustomPushRow?'當我這樣做
let row : CustomPushRow? = form.rowBy(tag: "Location")
我怎樣才能改變的CustomPushRow