WWDC24 SALE: Save 50% on all my Swift books and bundles! >>

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!

2      

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.

3      

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

2      

Save 50% in my WWDC sale.

SAVE 50% To celebrate WWDC24, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.