Reputation: 13
I am writing WeatherApp on Swift. I have problem with compilation which called "Extra argument in call". I am writing HourlyForecast and u can see there my code:
View Controller:
HourlyForecast.downloadDailyForecastWeather { (hourlyForecastArray) in
for data in hourlyForecastArray {
print("forecast data: \(data.temp, data.date)")
}
}
Part of HourlyForecast.swift:
init(weatherDictionary: Dictionary<String, AnyObject>) {
let json = JSON(weatherDictionary)
self._temp = json["temp"].double
self._date = currentDateFromUnix(unixDate: json["ts"].double!)
self._weatherIcon = json["weather"]["icon"].stringValue
}
How I can fix it?
Upvotes: 1
Views: 63
Reputation: 285270
You have to interpolate each variable separately
for data in hourlyForecastArray {
print("forecast data: \(data.temp), \(data.date)")
}
Notes:
Any
not AnyObject
.Codable
, it's much more efficient than SwiftyJSON.Upvotes: 3