ios - 函数声明一个不透明的返回类型
问题描述
我的 SwiftUI 结构中有以下函数
private func datePicker() -> some View {
if #available(iOS 14.0, *) {
return DatePickerCompactView(date: $modelController.eventModel.startAt)
} else {
return DatePickerWheelView(date: $modelController.eventModel.startAt)
}
}
但是,它给了我这个错误:
Function declares an opaque return type, but the return statements in its body do not have matching underlying types
为什么?它们都是一种View?我该如何解决?
解决方案
推荐阅读
- java - 使用实体列表在 JPA 中搜索和排序问题
- php - 如何将类中的 mySQL 结果传递给外部函数?
- android - 在 Recyclerview 中滚动后,选定的项目被取消选中
- three.js - 三个JS中camera LookAt和camera up的区别
- javascript - 在 Javascript 中更改 JSON 对象格式
- bluetooth - 为什么 bluetoothctl 正在扫描但不显示低功耗蓝牙设备?
- azure - 流分析:在同一个作业中处理压缩和未压缩的数据
- java - 如何将 JwtFilter 异常传递给服务器 JSON 答案?
- python - 如何跨多个 DataFrame 应用 if 语句?
- reactjs - immer JS 删除子数据或嵌套数据