for those who are lost: in the latest versions of swift/xcode, you should never use .ignoringSafeArea, and this entire video can be skipped in 2023. when you move a frame or stack or view to an edge, it will automatically make the background color "bleed" out into the unsafe areas for you.
Love all the videos so far, but this is the first video that I've come across that seems outdated (even beyond your update at the end). It looks like the 15.x version is smart enough to automatically extend background outside the safe area without needing to add any code. Of course, you could use the .ignoresSafeArea if you wanted your text to appear in those areas.
Hi Nick - Looks like things have changed. Running Xcode 13.2.1 - Seems like Apple has made things even safer and no need to use .ignoringSafeAreas. In the following code the frame consumes the entire screen in both the Preview and the Simulator, but the other objects are limited to the safe area:
The examples in this video were especially good. In particular, showing that you can inadvertently place text behind the iPhone notch was a really great example of what not to do. Thanks.
You called me right out at 07:00 As I take breaks and practice between videos I always do that edges and padding and thats the sloppiest part of my code I was literally just doing that before this video and testing different iPhones and had to keep adjusting, this vid is beautiful.
@@gibber1sh-c6w we need to pass an empty array for that e.g. `.background(Color.red, ignoresSafeAreaEdges: [])` this will ensure that the color stays within safe area Just wanted to add, I tried it on "Text" so I found that my text is staying within safe area and it's just the color was going beyond. Here's what I'm doing - VStack { Text("Hello, World!") Spacer() } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) .background(Color.red) So, Text is staying within safe area but color is ignoring that
Hi Nick, thanks for the course, really enjoying it so far. Just wanted to add that something must have changed between when you created it and now as your code's background no longer cuts off at the safe area margins. The background is now extending to the edges of the device without having to specify ignore safe area.
Wonderful! I try a lot of ways to fix the "bug"( I thought apple did not design it well, maybe they made a mistake, I still think so because it is not obviousely easy to use). You use a simple and clear way to fix the problem. Well done! Buddy
My .frame covers the whole screen, not just the safe area. I have the same code as you but yours stays with the safe area. I’m on Xcode 13.3.1. Did something change?
Can you explain how to do this on macOS Monterey? I got a 2021 MBP 14" with the "notch" and I want to run a simple window app that shows a color and when going full screen it uses the ENTIRE screen, not just the area below the notch. All attempts at using various methods that work on iOS fail on macOS Monterey as the app is always pushed below the notch into a safe area regardless. The reason I want to do this is to check for dead/stuck pixels at the TOP of the display in that menu bar area on a batch of new 2021 Macs. Thanks!
Something is strange here in both examples (Xcode 13.1).. It seems that .background() by default ignores the safe area when attached to a top-level component. Bug or feature, I'm not sure. The question now would be what is the opposite of .edgesIgnoringSafeArea() / .ignoresSafeArea(). Is there something like ".respectsSafeArea ()"? 🤔
Hi Kai, the background does NOT ignore the safe area by default. If your background layer is ignoring the safe area "by default" then it's probably in a view hierarchy where another modifier is forcing it to ignore the safe area lol. There is nothing like "respect safe area" you just need to manage their hierarchy and different layers of the view.
Same here! Xcode 13.1. Tried both examples and .background ignores the safe areas by default without needing to specify .edgesIgnoringSafeArea(). I would also want to know what is the cause of that.
Same with me. I followed the code he wrote exactly but it just seems to ignore the safe area regardless of if I use the '.edgesIgnoringSafeArea()' or not.
Bonjour. J'ai remarqué que le background (Color.red) ne respectait pas la safearea. Par contre le texte .. oui. Je pense qu'il s'agit d'un nouveau réglage des dernières versions de xcode .. Hello. I noticed that the background (Color.red) did not respect the safearea. On the other hand the text .. yes. I think this is a new setting of latest versions of xcode..
Hi guys. The question is kinda odd. But anyway, why did we get the method changed if it brings no new functionality ? I mean I don't mind, I am just wondering.
For me, when I have the scrollview not ignoring the safe area, the rounded rectangles when scrolled vertically travel outside the safe area. How you keep the scrolled items inside the safe area?
Hello Nick, Thanks for your videos. I would like to know about any features that are not available on old versions, would that be an issue for users, please?
@@SwiftfulThinking I'm talking about any new features or modifiers that come to SwiftUI like .ignoreSafeArea that target a specific Version. Does that affect the user of the app after launching or involve only the developer? I hope my question is straightforward :)
You blow me away with the simplicity and practicality of your lessons. Kudo's! As 'we' are building our own reference guide, why comment-out code while we can use multiple views/screens in our view struct. Per example a iPhone to go with it, building up the good and bad practice. Can't wait to finish the course. 💪🏽
for those who are lost: in the latest versions of swift/xcode, you should never use .ignoringSafeArea, and this entire video can be skipped in 2023. when you move a frame or stack or view to an edge, it will automatically make the background color "bleed" out into the unsafe areas for you.
Thank you for posting that!
No longer need to use the ZStack trick?
Its looks like the safe area is not working like that anymore. By default now the background ignores the safe area by default....
This guy wears helmet because he talks about safe areas.
The logic is just impeccable. LOVE IT
This guy's a clown! 🤡😂
Love all the videos so far, but this is the first video that I've come across that seems outdated (even beyond your update at the end). It looks like the 15.x version is smart enough to automatically extend background outside the safe area without needing to add any code. Of course, you could use the .ignoresSafeArea if you wanted your text to appear in those areas.
Just wanna say, I've been following from Bootcamp 1, I am learning a lot and thanks for the amazing videos!
Good luck Max!
the best teacher that i ever had in my life. thank you very much
You are so kind and thank you for continuing to provide helpful videos even after the iOS14 update.
Glad I didn't skip this video! Had no idea the .background modifier was a view! You the best! Button video here I come!
15:19 Good to have the update to ignoresSafeArea() . Thanks.
Hi Nick - Looks like things have changed. Running Xcode 13.2.1 - Seems like Apple has made things even safer and no need to use .ignoringSafeAreas. In the following code the frame consumes the entire screen in both the Preview and the Simulator, but the other objects are limited to the safe area:
Also works the same with .ignoresSafeArea.
@@brucknerdevilliers How we can make our background to be in the safe area ?
@@govindsolanki1295 Use ZStack
Me too
@@govindsolanki1295 Set ignoresSafeAreaEdges in background to empty array. For example: .background(.red, ignoresSafeAreaEdges: [])
Amazing tutorial,
Ngl, made me chuckle at 7:20 when you said "so before we end this video" with 10 minutes left
The examples in this video were especially good. In particular, showing that you can inadvertently place text behind the iPhone notch was a really great example of what not to do. Thanks.
You called me right out at 07:00 As I take breaks and practice between videos I always do that edges and padding and thats the sloppiest part of my code I was literally just doing that before this video and testing different iPhones and had to keep adjusting, this vid is beautiful.
Haha yea, I used to do the same thing too! I'm happy this helped you out.
Swiftful Thinking i havent got to the core data video yet im on vid 32/54 but a video series on firebase and data and networking would be great
Good catch on the change after 14.3. Once again excellent product. Thank you.
Thanks for the comment Paul!
Great video Nick! Seems like in Xcode 13, background modifiers ignore safe area by default.
How do we solve this problem?
@@gibber1sh-c6w we need to pass an empty array for that e.g. `.background(Color.red, ignoresSafeAreaEdges: [])` this will ensure that the color stays within safe area
Just wanted to add, I tried it on "Text" so I found that my text is staying within safe area and it's just the color was going beyond. Here's what I'm doing -
VStack {
Text("Hello, World!")
Spacer()
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
.background(Color.red)
So, Text is staying within safe area but color is ignoring that
Hi Nick, thanks for the course, really enjoying it so far. Just wanted to add that something must have changed between when you created it and now as your code's background no longer cuts off at the safe area margins. The background is now extending to the edges of the device without having to specify ignore safe area.
Wonderful! I try a lot of ways to fix the "bug"( I thought apple did not design it well, maybe they made a mistake, I still think so because it is not obviousely easy to use). You use a simple and clear way to fix the problem. Well done! Buddy
Maaan, these beginner contents are amazing. Thanks a lot for all of these videos !!!
Best teacher I have seen so far.
Superb thanks a lot :)
Thank you Kasun!!!
I'm really enjoying Your videos
I'm so glad!
Thanks 🙏 for updating this video …i was wondering…
best teacher out there
lol very generous of you, but thanks
You got skills
My .frame covers the whole screen, not just the safe area. I have the same code as you but yours stays with the safe area. I’m on Xcode 13.3.1. Did something change?
Thank you 🔥
Thank you!!!
Hi Nick
At 10:00 I found that the red colour in VStack cover whole screen including the safe area. Did something change in swift?
Same here. I'm guessing that the .background just by default ignores the safe area?
Same here
super nice. pero por suerte en xcode 15 ya no hace falta poner ignoreSafeArea. igual es muy bueno saber todo esto.
thanks Nick!
by default all my views go beyond the safe area. how to prevent this?
Thanks...
Thank you!!!!!!!!!!!!!
Thank you~
Can you explain how to do this on macOS Monterey? I got a 2021 MBP 14" with the "notch" and I want to run a simple window app that shows a color and when going full screen it uses the ENTIRE screen, not just the area below the notch. All attempts at using various methods that work on iOS fail on macOS Monterey as the app is always pushed below the notch into a safe area regardless. The reason I want to do this is to check for dead/stuck pixels at the TOP of the display in that menu bar area on a batch of new 2021 Macs. Thanks!
Something is strange here in both examples (Xcode 13.1).. It seems that .background() by default ignores the safe area when attached to a top-level component. Bug or feature, I'm not sure. The question now would be what is the opposite of .edgesIgnoringSafeArea() / .ignoresSafeArea(). Is there something like ".respectsSafeArea ()"? 🤔
Hi Kai, the background does NOT ignore the safe area by default. If your background layer is ignoring the safe area "by default" then it's probably in a view hierarchy where another modifier is forcing it to ignore the safe area lol. There is nothing like "respect safe area" you just need to manage their hierarchy and different layers of the view.
Same here! Xcode 13.1. Tried both examples and .background ignores the safe areas by default without needing to specify .edgesIgnoringSafeArea(). I would also want to know what is the cause of that.
Same for me. Xcode 13.4. Regardless what I do in my case whole screen has red background colour.
Same with me. I followed the code he wrote exactly but it just seems to ignore the safe area regardless of if I use the '.edgesIgnoringSafeArea()' or not.
@@SwiftfulThinkingH'es right. . I copied your code (at 4:44) and it behaves differently on XCode 13.4
Bonjour. J'ai remarqué que le background (Color.red) ne respectait pas la safearea. Par contre le texte .. oui. Je pense qu'il s'agit d'un nouveau réglage des dernières versions de xcode ..
Hello. I noticed that the background (Color.red) did not respect the safearea. On the other hand the text .. yes. I think this is a new setting of latest versions of xcode..
Hi guys. The question is kinda odd. But anyway, why did we get the method changed if it brings no new functionality ?
I mean I don't mind, I am just wondering.
Do you have link to your code used in these videos?
For me, when I have the scrollview not ignoring the safe area, the rounded rectangles when scrolled vertically travel outside the safe area. How you keep the scrolled items inside the safe area?
This is usually a good thing lol but you can use .clipped to clip views to their frame
Hello Nick,
Thanks for your videos. I would like to know about any features that are not available on old versions, would that be an issue for users, please?
Hi, I'm not sure your question. What type of feature do you want to know about?
@@SwiftfulThinking I'm talking about any new features or modifiers that come to SwiftUI like .ignoreSafeArea that target a specific Version. Does that affect the user of the app after launching or involve only the developer? I hope my question is straightforward :)
Dude! 10:09 there's that Command-/ described as Back Slash again. Your videos are so perfect otherwise.
Haha dude! Idk why I keep doing that. oyy
This guy is so not funny its funny
I’m cringing bro
Nah man its an entertaining breath of fresh air - appreciate you dude
Nice bro
God bless you brother ❤❤❤❤❤❤ Jesus Christ bless you brother ❤
Thanks again for your hard work , Thank you very much 🤎🤎
You blow me away with the simplicity and practicality of your lessons. Kudo's!
As 'we' are building our own reference guide, why comment-out code while we can use multiple views/screens in our view struct. Per example a iPhone to go with it, building up the good and bad practice.
Can't wait to finish the course. 💪🏽
Thanks for watching! Happy to help.