NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

SOLVED: Small, Medium & large home screen widgets

Forums > SwiftUI

Hello, Just look to confirm something. I have developed a Large home screen widget. I've used different versions of that code to create a Medium and Small versions. I'm not sure how how I can implement the small and medium widgets. Do I need to use WidgetBundle to do this? Thank you!

   

I am assuming that you are already using WidgetKit (as you have written a widget). You will also need to use .widgetFamily.

@Environment(\.widgetFamily) var family

and switch on the family to select the appropriate widget to display.

Have a look at the UlitmatePortfolio videos 42 and 43, which should give you some additional pointers.

Bear in mind that currently (19-May-2023) those videos are for the previous app created for the UltimatePortfolio, and not the current 2023 app (whose videos will appear in due course). Also, things might be a bit more swifty, rather than UI, now in Xcode 14.x.

1      

Great, thanks. I'll look into this. Thanks for the clarification.

   

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until October 1st.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.