Post

Replies

Boosts

Views

Activity

Reply to Understanding SwiftUI and control flow
Hi, I also had some problems with sheets and a Binding Bool in the past. I would try two things. Are you sure that the tmpEvent you set using showSheet() isn't returning an optional value that might be nil? you can try adding: guard let tmpEvent = Event(context: viewContext) else{ print("found nil") return } and if you see something in the log you know that it contains nil. This also prevents the sheet from being shown while the Event is nil. In general I would avoid having optionals in your views because you always have to deal with optional values, or risking that your app is getting terminated because of force unwrapping. If that doesn't work, try using an default value and see if it later on changes to the correct value. If this is the case, your sheet is presented before the event got an initial value... Take care, David
Aug ’21
Reply to Accept CKShare with the SwiftUI lifecycle.
Hi Kevin, Interestingly creating the share and the SharingController wasn't too difficult. Other than that the title of the SharingController sometimes just being "Untitled" it works as expected. No idea why the title configuration is sometimes not filled in correctly. I switched back to UIKit Lifecycle because it is just so frustrating seeing how little the SwiftUI lifecycle can do right now... I hope they will add these methods natively in future releases without the need of DelegateAdaptors. Take care, David
Mar ’21
Reply to User configurable WidgetKit backgrounds ?
Hi, yeah the thing with the battery widget and the forbidden background blur... Well at least for the configurable colors there is a solution. I have seen a few apps implement this feature. The easiest way I think is to use the widget configuration to give the user a list of options, and then storing the picked color. You could then get the color when building the widget, maybe UserDefaults or something like that, and set the background accordingly. The user could use the main app to edit and add colors to their list which is then displayed in the configuration... Even though it is a hacky solution it should work. Take care, David
Mar ’21
Reply to How to create Tappable Button in swiftui For Widgets
Hi, Widgets will always launch the app when they are tapped, so there is no way to only add an action to the widget. Depending on the Widget Size you have the option of using Tap targets. The small Widget only has one big button, itself. The large Widget has a few targets that can perform different actions by using different URLs, but they also launch the app. Take care, David
Feb ’21