Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Danny Kilkenny](https://uploads.teamtreehouse.com/production/profile-photos/6499062/micro_Kelly-79.jpg)
Danny Kilkenny
4,507 PointsHaving trouble with an error in the code of Constructing a URL video
I have an error that keeps popping up that says "Cannot cover value of type 'NSURL?' to expected argument type 'URL?' "
Can anyone help explain why this error keeps popping up? I am using swift 3.0 FYI
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let icon = WeatherIcon.PartlyCloudyDay.image
let currentWeather = CurrentWeather(temperature: 56.0, humidity: 1.0, precipitationProbability: 1.0, summary: "Wet and Rainy", icon: icon)
display(weather: currentWeather)
let baseURL = NSURL(string: "https://api.forecast.io/forecast/\(forecastAPIKey)")
let forecastURL = NSURL(string: "37.8267,-122.423", relativeTo: baseURL)
}
1 Answer
![Danny Kilkenny](https://uploads.teamtreehouse.com/production/profile-photos/6499062/micro_Kelly-79.jpg)
Danny Kilkenny
4,507 PointsI actually figured out the solution to the problem. Here is the code if anyone has this problem in the future:
let baseURL = URL(string: "https://api.forecast.io/forecast/\(forecastAPIKey)/")
let forecastURL = URL(string: "37.8267,-122.423", relativeTo: baseURL!)