在我的天气应用程序中,我在文本字段中调用天气预报,但出现错误:
No exact matches in call to initializer
.
以下是可能相关的代码:
ScrollView(.horizontal){
HStack(spacing: 5.0) {
ForEach(0..<25) {_ in
VStack{
Text([weather.hourly.hourly]) //Error
.bold()
.font(.subheadline)
.frame(width: 105, height: 15)
}
}
}
}
struct OneCall: Decodable {
let lat, lon: Double
let timezone : String
let timezone_offset : Int
let current: CurrentResponse
let hourly: HourlyResponse
struct HourlyResponse: Decodable{
let sunrise: Date?
let sunset: Date?
var hourly: Array<CurrentResponse>
}