Display pop-up Sheets and FullScreenCovers in SwiftUI | Bootcamp #28

  Рет қаралды 41,226

Swiftful Thinking

Swiftful Thinking

Күн бұрын

Пікірлер: 79
@sestier-1
@sestier-1 2 жыл бұрын
FYI: @Enviroment(\.presentationMode) will be deprecated, use this instead: @Enviroment(\.dismiss) var dismissScreen and you will call it in the action of your button as a function, like this: dismissScreen().
@jakemoore3008
@jakemoore3008 Жыл бұрын
Thank you! I love that I can ALWAYS come into the comments when I get a "deprecated" warning, and someone awesome like you has explained the new methods!
@DannyBoy443
@DannyBoy443 6 ай бұрын
Also, he never (previously) explained the environment wrapper.
@maguirer
@maguirer 3 жыл бұрын
28 videos in, and you finally called a backslash a backslash! 🥳 Really enjoying the videos so far, Nick!
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Haha sorry Bob! I didn't even realize until someone had commented that I was saying it wrong 😔 I'm still getting used to coding while talking out loud. Thanks for watching though!
@bhagyashingale5663
@bhagyashingale5663 3 жыл бұрын
Update - You can now call multiple sheet modifiers or use conditionals within one
@ahmedmohamedyousef8078
@ahmedmohamedyousef8078 2 жыл бұрын
PresentationMode is Deprecated, we can use @Environment(\.dismiss) var dismiss or @Environment(\.isPresented) var isPresented
@ShowMeLova
@ShowMeLova 10 ай бұрын
Thank you Nick! It is extremely fascinating to learn Swift UI with you❤
@iAmDavidA
@iAmDavidA 2 жыл бұрын
It looks like the presentation mode has been deprecated since iOS 15. To go about dismissing do: @Environment(\.dismiss) var dismiss And then call dismiss: dismiss()
@muhammedturk_22
@muhammedturk_22 2 жыл бұрын
Thank you for this information.
@sai2989
@sai2989 2 ай бұрын
thanks
@lisbettegomez
@lisbettegomez Жыл бұрын
This is sooo excited!!! hahah I just jumped from my bed when you crate the second screen and it worked hahaha
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
Haha nice! 🚀🦊
@dugrut1325
@dugrut1325 2 жыл бұрын
this was amazing, i have so many ideas, no longer limited to one screen apps
@ConfidentlyRong-jo5yt
@ConfidentlyRong-jo5yt 5 ай бұрын
Loving it! Thanks man!
@SwiftfulThinking
@SwiftfulThinking 5 ай бұрын
You are cruising through the playlist! 🚀
@ConfidentlyRong-jo5yt
@ConfidentlyRong-jo5yt 5 ай бұрын
@@SwiftfulThinking Still can't believe it's FREE!
@bbulliard
@bbulliard 2 жыл бұрын
So well done! You are the best! Will provide you some coffee! Bob
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thank you Bob!
@parthpatel9096
@parthpatel9096 Жыл бұрын
i just loved the way u make things easy to under stand amazing!😊
@dugrut1325
@dugrut1325 2 жыл бұрын
Great video... again! The 'bulb' is starting to glow, not as dim!
@julianm080808
@julianm080808 10 ай бұрын
Hey nick thanks for your video I had figured it out my issue hopefully
@abdullahalnutayfi8103
@abdullahalnutayfi8103 3 жыл бұрын
Hello, I added switch statement inside sheet, and it works perfectly
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
I would be careful haha
@yassirbisteni9273
@yassirbisteni9273 5 ай бұрын
Hi, which is the video for the advanced fullscreen conditionals?, thanks!
@hakobghlijyan
@hakobghlijyan Жыл бұрын
hello , I want to implement a transition to the second screen, which is located in another file. how to do it? .sheet
@WattsnabbAB
@WattsnabbAB 3 ай бұрын
What is the best practice use when I want to present fullscreencover on 50% of the first screen?
@bobbynwm
@bobbynwm Жыл бұрын
Nick, do you know how would we call or create that sort of popup window that comes for few secs and disappears afterwards ? For eg. when you Love a song in Apple Music, you will see that popup with ultraThinMaterial background that comes up for few secs and goes away afterwards.
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
You could just do a simple ZStack and toggle a local Boolean value. Set it to true and add a delay for setting it back to false!
@magedmohmed4403
@magedmohmed4403 2 жыл бұрын
Thank you for your helpful tutorial 🤎🤎
@njasow5234
@njasow5234 7 ай бұрын
I noticed at 9:00 when the sheet pops up, the view underneath it also slides down revealing a white sliver above both views. Do you know how to get rid of this? or at least change the color of it?
@leneil46
@leneil46 Жыл бұрын
Excellent video
@ZhengCheng
@ZhengCheng 3 жыл бұрын
@Environment should have a separate video @Enviroment(\.presentationMode) var presentationMode is confusing
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Hi Zheng, great idea. I will try to discuss the @Environment soon!
@ChromeBreakerD
@ChromeBreakerD Жыл бұрын
@SwiftfulThinking Is this still accurate at 10:35? I conducted tests on conditional logic in Sheets, and it appears to be functioning correctly. I also examined your statement that "the sheet generates the content when the view loads," but it didn't happen instantly for me. Instead, it initialized only when I opened the sheet. It seems like Sheets might exhibit lazy behavior in this regard. I would appreciate your feedback, as this has left me somewhat perplexed.
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
It may have been updated to be Lazy in recent versions of SwiftUI. I will have to check, but I wouldn’t be surprised. We have seen similar updates for other modifiers too. Generally, lazy is better 👍
@quarrlk
@quarrlk 6 ай бұрын
to dismiss the sheet in SwiftUI 15, is it ok to just toggle the isPresented variable in the sheet content?
@hashemakkad6439
@hashemakkad6439 Жыл бұрын
Hi, thanks for this great videos, I'm watching one by one since Bootcamp # 1 For this one I've made exactly like what you did here and it's working fine, but out of curiosity I've tried another way and it worked just fine as well, it's by using Binding property wrapper as you explained in the video # 22, and it's doing the same thing without the need to use @Environment. But I'm not sure if this could be done in real Apps. Or would it make a conflict with something else.
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
Either works… Binding requires you to pass the Binding directly… whereas the Environment can be pulled from any child view (it can be easier to access in a deeper View hierarchy)
@gccount
@gccount 10 ай бұрын
Update: from the developer documentation, right now you need only to toggle the isPresented, then sheet dismissed, magically .
@supriyodey3258
@supriyodey3258 2 жыл бұрын
How to change transition in fullScreenCover. I want the transition from leading
@DannyBoy443
@DannyBoy443 6 ай бұрын
Does Nick ever explain ignoreSafeArea?
@SwiftfulThinking
@SwiftfulThinking 6 ай бұрын
Here kzbin.info/www/bejne/lWGxdX6uq8uaapIsi=T_aaSQlhHeNKpr2N and here kzbin.info/www/bejne/pn-Yi4CMlJihpqcsi=MHKNvbnaz7l-y_-y
@DannyBoy443
@DannyBoy443 6 ай бұрын
@@SwiftfulThinking Thank you!
@julianm080808
@julianm080808 10 ай бұрын
Nick how's it going, please someone can share with the code of the class because I am having an error that says Invalid redeclaration of 'SecondScreen' time 05:41
@sai2989
@sai2989 2 ай бұрын
// // Display pop-up Sheets and FullScreenCovers.swift // SwiftUI Part 2 // // Created by mac on 9/18/24. // import SwiftUI struct Display_pop_up_Sheets_and_FullScreenCovers: View { @State var showSheet: Bool = false var body: some View { ZStack{ Color.orange.opacity(0.4) .edgesIgnoringSafeArea(.all) Button(action: { showSheet.toggle() }, label: { Text("Button") .foregroundColor(.black) .font(.headline) .padding(20) .background(Color.white.cornerRadius(20)) }) .sheet(isPresented: $showSheet, content: { SecondScreen() }) } } struct SecondScreen: View{ @Environment(\.dismiss) var dismiss var body: some View{ ZStack(alignment: .topLeading){ Color.red.opacity(0.4) .edgesIgnoringSafeArea(.all) Button(action: { dismiss() }, label: { Image(systemName: "xmark") .foregroundColor(.red) .font(.largeTitle) .padding(20) .background(Color.red.opacity(0.2).cornerRadius(20)) }) } } } struct Display_pop_up_Sheets_and_FullScreenCovers_Previews: PreviewProvider { static var previews: some View { Display_pop_up_Sheets_and_FullScreenCovers() SecondScreen() } } }
@zackyilahiazmi4269
@zackyilahiazmi4269 2 жыл бұрын
Hello, when you apply sheet, i can notice the background instead of green there is white color on border, can you specify this white color and turn into another color?
@MarcelQT
@MarcelQT Жыл бұрын
What’s the difference here between using a full screen cover vs a navigation stack and link to a new page?
@hanzhechang2906
@hanzhechang2906 3 жыл бұрын
Hi, how if i use binding in secondScreen? pass the showSheet boolean into secondScreen and set back to false?
@software-turtle
@software-turtle Жыл бұрын
Is using @Binding instead @Environment to close sheet wrong?
@seanwei9067
@seanwei9067 2 жыл бұрын
You are the best, could you tell me how to add transition on .fullScreenCover?
@riceegg7950
@riceegg7950 3 жыл бұрын
NIce job, It is very helpful, thanks man
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Thank you for watching man!
@lolrie
@lolrie Жыл бұрын
Hey Nick - how did you select the entire block of code at 4:40? Is there a hotkey for it? Thanks!
@ChibiBlasphem
@ChibiBlasphem Жыл бұрын
Cursor was already at the bottom of the block he used Shift + click tu select :)
@praveenkumar-yj5mm
@praveenkumar-yj5mm Жыл бұрын
showSheet is @State propery wrapper, but you are using it as bindable while presenting the sheet with $showSheet. How is this possible without defining it as @Binding.?
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
This is the magic of SwiftUI 👍
@bbulliard
@bbulliard 3 жыл бұрын
Great video
@soufianebenkhaldoun849
@soufianebenkhaldoun849 3 жыл бұрын
thank you for everything Nick, you solved a lot of questions that I had (forza Italia)
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Haha forza!!! 😂 Glad you're enjoying the vids!
@bbulliard
@bbulliard 3 жыл бұрын
I see you have saved all boot camps in 1 swift file. Is there a way i can download all 50 bootcamps in that file?
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Hey Bob! Yes, the source code is available on my Github: github.com/SwiftfulThinking
@senamahadzi5716
@senamahadzi5716 3 жыл бұрын
Would use of Enums be a good option to show different sheets?
@knowledgeispower4953
@knowledgeispower4953 10 ай бұрын
Nice bro...🤗
@yumindev
@yumindev 3 жыл бұрын
When you dismiss the sheet, what about the value of "showSheet" in the parent view ? Does it become false or stay being true ?
@BlackLightning0Games
@BlackLightning0Games 2 жыл бұрын
Using Text("\(showSheet.description)") I can confirm that when the sheet is dismissed the value returns to "false"
@onezen
@onezen 2 жыл бұрын
Thanks a lot!
@yuchen3587
@yuchen3587 2 жыл бұрын
It seems that I can build an entire app based on this series lol
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
You wouldn’t be the first 😂🥳🔥
@perrinmatias
@perrinmatias 3 жыл бұрын
Nice!
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
:)
@Денис-ж3ф5р
@Денис-ж3ф5р 3 жыл бұрын
brilliant
@최승기-g8f
@최승기-g8f 3 жыл бұрын
Thank you!!!
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
You're welcome 최승기 !
@kingcopones5205
@kingcopones5205 3 жыл бұрын
Hi! does sheet and full-screen cover supports dark theme?
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Yes they should haha
@Денис-ж3ф5р
@Денис-ж3ф5р 3 жыл бұрын
You sold me. subscription
@Денис-ж3ф5р
@Денис-ж3ф5р 3 жыл бұрын
Thee main takeaways 12:22 the comment for myself.
@natgenesis5038
@natgenesis5038 2 жыл бұрын
12:38 reference
Multiple Sheets in a SwiftUI View | Continued Learning #7
22:24
Swiftful Thinking
Рет қаралды 19 М.
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 24 МЛН
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 13 МЛН
How to use NavigationStack in SwiftUI | Bootcamp #62
23:59
Swiftful Thinking
Рет қаралды 37 М.
How to use @Binding property wrapper in SwiftUI | Bootcamp #22
12:40
Swiftful Thinking
Рет қаралды 37 М.
🔴 Sheets in SwiftUI | Everything you need to know
22:05
AppStuff
Рет қаралды 6 М.
8 Common SwiftUI Mistakes - and how to fix them!
28:05
Paul Hudson
Рет қаралды 50 М.
How to use Popover modifier in SwiftUI | Bootcamp #69
18:04
Swiftful Thinking
Рет қаралды 10 М.
Why You Should Use The SwiftUI Coordinator Pattern
18:45
Rebeloper - Rebel Developer
Рет қаралды 16 М.
CoreData в Swift. Разработка приложений
47:55
simpleDEV. Swift c нуля до бесконечности
Рет қаралды 9 М.
SwiftUI Grids - LazyVGrid, LazyHGrid, Static Grid
17:55
Sean Allen
Рет қаралды 14 М.
NavigationStack - SwiftUI Programmatic Navigation - iOS 16
20:20
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 24 МЛН