It took me 6 hours to complete this demo. This tutorial was a great start for my iOS app development. Thank you so much. I learnt a lot, my next step is to learn SwiftUI elements and add more functionality on top of this, like automatically changing metric to imperial and vice versa on the user input. Changing the icons automatically when the weather is hot, humid, cold, sunny, changing the background theme (day, night) based on the timing.
You can actually use simulator to test the app AND get the location. Just select Features/Location and choose any you want. So it's not mandatory to use your iphone.
I'm having an unkown error in the do catch part in ContentView (19:57), wherein my program keeps on crashing. It says to see backtrace for more information, but it says that there is an unknown error in the do catch part. Does anyone know the solution to this problem I'm having?
Here you go, from the GitHub: github.com/stephdiep/WeatherApp/commit/d0210ed7d4b9775d58d48f6fb842d04b9fd7a1a1 struct ResponseBody: Decodable { var coord: CoordinatesResponse var weather: [WeatherResponse] var main: MainResponse var name: String var wind: WindResponse struct CoordinatesResponse: Decodable { var lon: Double var lat: Double } struct WeatherResponse: Decodable { var id: Double var main: String var description: String var icon: String } struct MainResponse: Decodable { var temp: Double var feels_like: Double var temp_min: Double var temp_max: Double var pressure: Double var humidity: Double } struct WindResponse: Decodable { var speed: Double var deg: Double } } extension ResponseBody.MainResponse { var feelsLike: Double { return feels_like } var tempMin: Double { return temp_min } var tempMax: Double { return temp_max } }
hey i'm getting an error. the code " location = locations.first?.coordinate" the error says Value of type 'CLVisit' has no members 'first'. what do i do?
When I try to connect my phone with mac, the build fails and I get this errror Signing for "weather" requires a development team. Select a development team in the Signing & Capabilities editor.
why me getting this error Fatal error: No ObservableObject of type LocationManager found. A View.environmentObject(_:) for LocationManager may be missing as an ancestor of this view.
hey guys! so im stuck on the location manager in the code location = locations.first?.coordinate, it isn’t reading the first location tag and is giving me an error. any suggestions?
Hi, it's available on designcode.io: Part 1: designcode.io/quick-apps-swiftui-weather-app-1 Part 2: designcode.io/quick-apps-swiftui-weather-app-2 Part 3: designcode.io/quick-apps-swiftui-weather-app-1
when doing @StateObject var locationManager = locationManager(). i end up with an error that just says "circular reference" any ideas why ? my code up to this point has been exactly the same as in the video.
if for example I want to replace the coordinates in this code with the coordinates depending on the location how do I do it? let coordinates = Coordinates(latitude: 12.123456, longitude: 98.987654)
Hi, the code already gets the current location of the user. If you wish to hard-code some coordinates, you'll need to create a CLLocationCoordinate2D (see developer.apple.com/documentation/corelocation/cllocationcoordinate2d). - Stephanie
Just do a simple research on Google for the service you're looking for with "API" at the end of your search terms and I'm sure you'll find an API/library for that. Otherwise, there's this list of public APIs hosted on Github: github.com/public-apis/public-apis Hope that helps! - Stephanie
When I get to testing the application it fails. Shows nothing but a black screen and gives me and error code. EXC_BAD_ACCESS. I have checked ove the code several times and cant sort the bug.
Hi! Try to Clean Build Folder (Shift + Command + K) and build your application again. Also, you won't be able to get the weather on the Simulator, so make sure to test on an actual device. - Stephanie
@@DesignCodeTeam I get the same error, even when testing on an actual device. I'm using Xcode 13.2.1 and iOS 15.2. It's occuring on "@main" in the main app swift file (which points to ContentView()).
Hello, Stephanie! I'm studying for iOS while watching tutorial videos. I have a question while watching the video. The weather app area is in New York, USA. Can I change it to Seoul, Korea? Or should I use it in New York like a video?
Hi! New York is only the location for the dummy data, but you can change it to whichever location you wish, it doesn't matter! Also, the real data you'll get once you build the app will be the current weather conditions from your physical location. ☺️ - Stephanie
Hi! You'll need to add the preview data yourself by adding the load function with dummy JSON data for the weather: th-cam.com/video/X2W9MPjrIbk/w-d-xo.html The Data from JSON section can be found (with the load function) at designcode.io/swiftui-advanced-handbook-data-from-json - Stephanie
Just head over to openweathermap.org/api to learn which endpoint to call to get forecast weather. You can get the 4 days, 16 days or even 30 days forecast with the OpenWeather API. As for the animation, I suggest you to follow Meng's tutorials where he teaches how to make animations with SwiftUI! - Stephanie
Hi, great work on the App. I'm getting an error in the Content View when I try to load the weather data. The "if weather = weather " code in the Content View code is throwing an error and advising I use boolean
Leaving this answer here in case someone needs it in the future: This is most likely because you haven't yet used the variable weather yet. So the suggestion is that if you are not planning on using the variable, replace it with a boolean conditional instead
Leaving this answer here in case someone needs it in the future: This is most likely because you haven't yet used the variable weather yet. So the suggestion is that if you are not planning on using the variable, replace it with a boolean conditional instead
@@michaelvarghesethomas8878 Hi, you seem to understand quite a lot, I have copied her code word for word but on the weatherView page it can never make the preview as it says that there is a fatalerror in the ModelData? any ideas?
Hi! You're supposed to be able to run it in the Simulator, and see the WelcomeView. However, you can't get the location on the Simulator (it's not a feature supported by the Simulator) and you'll need to test it on an actual device. - Stephanie
@@DesignCodeTeam Actually you should be able to use the location inside the Simulator as well. Check Features > Location in the Simulator menu, there you can select predefined locations or even use a custom one.
Thank You for the tutorial. I've created the app but I can't see the weather.name in the Weather App in my device - iPhone 11 Pro Max. Its the same case for 11 Pro Max in iOS simulator. But in iOS 13 Simulator I can see it. Any particular reason? Very good tutorial regardless. Thank You!
Hi Tharindu! The weather.name shouldn't be a problem on any device. Just make sure that when you query the data from the API, you get the name in the data you fetched. - Stephanie
@@Owen02_ If you get any error. copy paste the code and add "keep the code 100% as it is and fix the errors only" in chatgpt. it will keep the code styling as it is and fix the error for you. Then you can ask what was the error and how it fixed it
You can try cloud services, but it's expensive, some like 100$/month for remote screen access to device, and it's has problems with testing on your iOS device
Hi! I would say the tutorials about SwiftUI on Design+Code, as it's a big library covering many different concepts related to SwiftUI, as well as Hacking with Swift. Those are the resources I go back to the most! - Stephanie
fail to compile due to cannot find "WeatherRow" in scope, it looks like "WeatherRow" is not well defined in "WeatherView" file. any solutions on this? thanks.
This gave me a boost in my SwiftUI learning path!
It took me 6 hours to complete this demo. This tutorial was a great start for my iOS app development. Thank you so much. I learnt a lot, my next step is to learn SwiftUI elements and add more functionality on top of this, like automatically changing metric to imperial and vice versa on the user input. Changing the icons automatically when the weather is hot, humid, cold, sunny, changing the background theme (day, night) based on the timing.
I could make this explanation easier tbf
Thanks Stephanie! I have experience in ObjC and Flutter, so this tutorial gives me all I need to get started in SwiftUI!
thanks for kickstarting my iOS dev career...much love❤️
You're welcome, thanks for watching!
Best channel for iOS dev, thank you!
Glad you like it!
Great tutorial. Clear, fast paced and informative. Keep ip the great work look forward to watching other videos from you.
Glad it was helpful!
Excellent, I’ll rewatch this again
Thanks for watching until the end!
Thanks, good pacing and the final result is very polished-looking
Thank you!
just started learning swift, and this is a great first project to build
Great to hear!
@@DesignCodeTeam can you also add tutorial for uikit project?
Thanks Stephanie for this awesome tutorial it was definitely really useful. Keep it up. God bless you.
at 12:10 swift does not permit you to write that on separate lines it will have to be a continuation or else you will get an error
in 18:07, were did you get the huge chunk of code?
^
Found it in the gitHub files linked > Under 'Managers' folder.
Thank you so much for the tutorial :))
You're welcome!
third time around, 1st time I just copied your code, app worked. But now I'm trying to understand the coding...
Where do I get the response body?
Would it be possible to give us a tutorial on how to include unit tests on swiftUI please? It would be great!! 😊🙏
It should give you the option when first creating the project.
Her accent made me stick to the very end. And great tutorial. Thank you
Great job. Obj-C dev here - Swift is much easier.
It sure is!
where did you get the response body from? I don't get where we can copy and paste that from
ok found it from the github source code
Excellent presentation and explanation, thank you!
Glad you enjoyed it!
You can actually use simulator to test the app AND get the location. Just select Features/Location and choose any you want. So it's not mandatory to use your iphone.
nice and detailed tutorial. thanks
best tutorial to swift !
Fantastic tutorial.
Hello from Montréal 😀 amazing tutorial
I'm exhausted! Thanks
I'm having an unkown error in the do catch part in ContentView (19:57), wherein my program keeps on crashing. It says to see backtrace for more information, but it says that there is an unknown error in the do catch part.
Does anyone know the solution to this problem I'm having?
Mam it shows like Thread 1: EXC_BAD_ACCESS(code=2, address=0x7ffee5163ff8) what is the solution ?
Thanks ,great tutorial.
You're welcome!
Where do you get the struct ResponseBody and the others below it in the Weather manager?
Here you go, from the GitHub: github.com/stephdiep/WeatherApp/commit/d0210ed7d4b9775d58d48f6fb842d04b9fd7a1a1
struct ResponseBody: Decodable {
var coord: CoordinatesResponse
var weather: [WeatherResponse]
var main: MainResponse
var name: String
var wind: WindResponse
struct CoordinatesResponse: Decodable {
var lon: Double
var lat: Double
}
struct WeatherResponse: Decodable {
var id: Double
var main: String
var description: String
var icon: String
}
struct MainResponse: Decodable {
var temp: Double
var feels_like: Double
var temp_min: Double
var temp_max: Double
var pressure: Double
var humidity: Double
}
struct WindResponse: Decodable {
var speed: Double
var deg: Double
}
}
extension ResponseBody.MainResponse {
var feelsLike: Double { return feels_like }
var tempMin: Double { return temp_min }
var tempMax: Double { return temp_max }
}
I can't get the decode chunk at 18:05 because its locked behind a paywall. either I'm missing something or that's just shitty
Hi,
You can get it in the source code: github.com/stephdiep/WeatherApp
- Stephanie
@@DesignCodeTeam thx u so much!
I keep getting the error "Value of type 'Double' has no member 'roundDouble'" Does anyone have any ideas.
She made extension func for this
Good work 👍
You are amazing!
It was very helpful thank a lots
where did you get icon folder?
The weather logo doesn't change in the WeatherView. For example, even though its cloudy, the logo displays systemName: "sun max".
Yes, that's why in the conclusion I mentioned this as a possible feature to improve the app! :)
- Stephanie
hey i'm getting an error. the code " location = locations.first?.coordinate" the error says Value of type 'CLVisit' has no members 'first'. what do i do?
Hi, is there any way to eliminate the first share location process? I tried to run it on appear and it takes a lot of time
When I try to connect my phone with mac, the build fails and I get this errror
Signing for "weather" requires a development team. Select a development team in the Signing & Capabilities editor.
I’m lost on the part about the json file
I'm having a fatal error that states "Couldn't parse weatherdata.json as ResponseBody" does anybody have any idea on how to fix this error?
Literally going through this problem now as well. Have you checked spelling, not that that solved it for me!
same issue, something is wrong with the way she is parsing that weatherData.json
@@khaleelobrien2277 did you get it?
did you fix it?
why me getting this error Fatal error: No ObservableObject of type LocationManager found. A View.environmentObject(_:) for LocationManager may be missing as an ancestor of this view.
hey guys! so im stuck on the location manager in the code location = locations.first?.coordinate, it isn’t reading the first location tag and is giving me an error. any suggestions?
How do you get the information from the JSON, having difficulty finding it, thank you
I'm really confused about the code you can get from the text content to copy and paste. I don't understand where it is.
Hi, it's available on designcode.io:
Part 1: designcode.io/quick-apps-swiftui-weather-app-1
Part 2: designcode.io/quick-apps-swiftui-weather-app-2
Part 3: designcode.io/quick-apps-swiftui-weather-app-1
when doing @StateObject var locationManager = locationManager(). i end up with an error that just says "circular reference" any ideas why ? my code up to this point has been exactly the same as in the video.
Not sure if you figured it out, but it should be LocationManager() and not locationManager()
how can I get the assets?
감사합니다.
I wanted to ask you what method is used in this course, is it MVC, MVVM or something like that...just because I am curious please 🙏
Thank you for this tutorial🙃 how can i make autoreload? For example every 1 hour data reload automatically?
where can I get Jason file ?????
if for example I want to replace the coordinates in this code with the coordinates depending on the location how do I do it?
let coordinates = Coordinates(latitude: 12.123456, longitude: 98.987654)
Hi, the code already gets the current location of the user. If you wish to hard-code some coordinates, you'll need to create a CLLocationCoordinate2D (see developer.apple.com/documentation/corelocation/cllocationcoordinate2d).
- Stephanie
How can I get images just like you?
Why does my location take so long to load? how to make it faster or instantly
Where can i find the assets???
great video
is it possible to give us the assets? would be really helpful
I'm getting a fatal error thread one whenever i try to fetch the data... how do i work around that?
Yep same issue., the progress view does not end, the app has been going on for the last @# minutes still no data
How do you find apis and libraries for other apps/ programs
Just do a simple research on Google for the service you're looking for with "API" at the end of your search terms and I'm sure you'll find an API/library for that. Otherwise, there's this list of public APIs hosted on Github: github.com/public-apis/public-apis
Hope that helps!
- Stephanie
Good stuff
Thank you!
How to get assets?
can you link where you copied new york weather from ? Very good Video ❤️
Hi!
Just replace the YOUR_API_KEY by your own:
api.openweathermap.org/data/2.5/weather?q=New%20York&appid=YOUR_API_KEY&units=metric
- Stephanie
Do we need to have an iPhone to test if location permission is working or not?
nope, location works fine in emulator
How can we add a radar?
When I get to testing the application it fails. Shows nothing but a black screen and gives me and error code. EXC_BAD_ACCESS. I have checked ove the code several times and cant sort the bug.
Hi! Try to Clean Build Folder (Shift + Command + K) and build your application again. Also, you won't be able to get the weather on the Simulator, so make sure to test on an actual device.
- Stephanie
@@DesignCodeTeam I get the same error, even when testing on an actual device. I'm using Xcode 13.2.1 and iOS 15.2. It's occuring on "@main" in the main app swift file (which points to ContentView()).
Hello, Stephanie! I'm studying for iOS while watching tutorial videos. I have a question while watching the video. The weather app area is in New York, USA. Can I change it to Seoul, Korea? Or should I use it in New York like a video?
Hi! New York is only the location for the dummy data, but you can change it to whichever location you wish, it doesn't matter! Also, the real data you'll get once you build the app will be the current weather conditions from your physical location. ☺️
- Stephanie
I'm getting an error saying 'cannot find previewWeather In scope' is there a way to fix it?
Hi! You'll need to add the preview data yourself by adding the load function with dummy JSON data for the weather: th-cam.com/video/X2W9MPjrIbk/w-d-xo.html
The Data from JSON section can be found (with the load function) at designcode.io/swiftui-advanced-handbook-data-from-json
- Stephanie
@@DesignCodeTeam great, thank you so much!
Great video, but you don't really explain any line of code you write you're just reading it.
When I archive the project I've Cannot find 'PreviewWeather' in scope
Oh, sorry about that! ModelData.swift should've been moved outside of the Preview Content folder. Then the Archive will succeed 🙂
-Stephanie
@@DesignCodeTeam Greate thanks, And how can I add the forecast weather and some animation ? thanks
Just head over to openweathermap.org/api to learn which endpoint to call to get forecast weather. You can get the 4 days, 16 days or even 30 days forecast with the OpenWeather API. As for the animation, I suggest you to follow Meng's tutorials where he teaches how to make animations with SwiftUI!
- Stephanie
Hi, great work on the App. I'm getting an error in the Content View when I try to load the weather data. The "if weather = weather " code in the Content View code is throwing an error and advising I use boolean
Leaving this answer here in case someone needs it in the future: This is most likely because you haven't yet used the variable weather yet. So the suggestion is that if you are not planning on using the variable, replace it with a boolean conditional instead
Leaving this answer here in case someone needs it in the future: This is most likely because you haven't yet used the variable weather yet. So the suggestion is that if you are not planning on using the variable, replace it with a boolean conditional instead
@@michaelvarghesethomas8878 Hi, you seem to understand quite a lot, I have copied her code word for word but on the weatherView page it can never make the preview as it says that there is a fatalerror in the ModelData? any ideas?
I tried to run the app on simulator it crashed! Can't we just run it on simulator? it showed me some error in fatalError like Thread1: FatalError
Hi! You're supposed to be able to run it in the Simulator, and see the WelcomeView. However, you can't get the location on the Simulator (it's not a feature supported by the Simulator) and you'll need to test it on an actual device.
- Stephanie
@@DesignCodeTeam Actually you should be able to use the location inside the Simulator as well. Check Features > Location in the Simulator menu, there you can select predefined locations or even use a custom one.
I imported your code from github and it still doesn't work. is anything outdated?
This is my First Programming Tutorial I used to code in javascript but I hate js I am thinking of relearning my coding skill from scratch
Awesome
Appreciate it!
Thank You for the tutorial. I've created the app but I can't see the weather.name in the Weather App in my device - iPhone 11 Pro Max. Its the same case for 11 Pro Max in iOS simulator. But in iOS 13 Simulator I can see it. Any particular reason? Very good tutorial regardless. Thank You!
Hi Tharindu! The weather.name shouldn't be a problem on any device. Just make sure that when you query the data from the API, you get the name in the data you fetched.
- Stephanie
I have the problem too. Always show progressview .I debuged fetched api data,but not show weatherview.
Why do I still have errors tho
weather row is not aligned perfectly
whats does it mean "manager.delegate = self" - 4 min 56 sec
We need to assign a delegate to our CLLocationManager instance, so we're assigning the class we're in (LocationManager) as its delegate
- Stephanie
i get fatal error "error fetching weather data" any idea why?
I’m also getting this error, were you able to fix it?
@@Owen02_ yes, you need to remove the double quotes when adding the api key in the link and check for any extra spaces added
@@Owen02_ If you get any error. copy paste the code and add "keep the code 100% as it is and fix the errors only" in chatgpt. it will keep the code styling as it is and fix the error for you. Then you can ask what was the error and how it fixed it
@@ShreddderrrWhich quotes specifically? And also Is it the part of the code that’s made in the video at 16:39 ?
@@Owen02_can you copy paste your code
If i use windows, can i do ios apps with swiftUI?
Hi! In the tutorial we're using Xcode, and it's only available on Mac, unfortunately 😕
- Stephanie
You can try cloud services, but it's expensive, some like 100$/month for remote screen access to device, and it's has problems with testing on your iOS device
i like swift
Excuse me, I think this is a problem about weatherRow the top and bottom on this design are not on the same line how to fix it
best part was you hide your location coordinates .... hahaha
how can get full source code ?
Hi, you can access it here: github.com/stephdiep/WeatherApp
❤️
🙏
You can simulate location on Simulator, so you don't need the real device.
can anyone help me out
Yes İ can help
For some reason the weather is displayed in kelvins
Tell us about your secret resources
Hi! I would say the tutorials about SwiftUI on Design+Code, as it's a big library covering many different concepts related to SwiftUI, as well as Hacking with Swift. Those are the resources I go back to the most!
- Stephanie
👍
Johnson Brenda White Patricia Miller Melissa
小姐姐的母语是中文嘛?
i fall in love with her..
disLike and also unfollow , from the beginning you can report that you must pay to get the content
I dont know how to code, i just came because she looked cute
Send #🥺
this doesn't work - fails at too many levels.
fail to compile due to cannot find "WeatherRow" in scope, it looks like "WeatherRow" is not well defined in "WeatherView" file. any solutions on this? thanks.
Thank you so much for the tutorial :))