mamot.fr is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mamot.fr est un serveur Mastodon francophone, géré par La Quadrature du Net.

Server stats:

3.3K
active users

#swiftui

78 posts40 participants6 posts today
Continued thread

#SwiftUI's Color.mix(with:by:in:) makes it easy to increasingly interpolate the current foreground color towards white (or black) while keeping its hue reasonably intact.

Heeeelp!

What does the following error mean, and how do I fix it? It happens, when I call `modelContext.save()` in a SwiftUI view.

"SwiftData/ModelCoders.swift:105: Fatal error: Composite Coder only supports Keyed Container”

Edit: Solved! It appears SwiftData does not support Duration properties in models. Changing it to a TimeInterval instead fixes it.

Today in TIL...

I have been struggling with understanding how to import whatever might be on the clipboard and this bit of code helped immensely.

If you copy an image in Safari via the context menu, there are actually nearly 20 different objects placed on the clipboard.

If this is documented anywhere, I never found it.

SwiftUI supports several scene types on macOS, and they each serve a different role, from managing multiple windows to adding menu bar functionality. I have a post that covers them all, and I often find myself referring back to it for a quick reference: nilcoalescing.com/blog/ScenesT
#SwiftUI #macOSDev

Nil CoalescingScenes types in a SwiftUI Mac appDiscover how to leverage SwiftUI's versatile scene types, like WindowGroup, DocumentGroup, Settings, Window, and MenuBarExtra, to create efficient and dynamic macOS applications.

Thought I was clever making a custom drawer component, only to realize that SwiftUI already has a DisclosureGroup component that’s literally the same thing 🤦‍♂️. Weird thing tho is that my custom component would ignore its transition animations to show/hide its content if the component was rendered inside of a List or Form. DisclosureGroup works just fine under a List. What am I missing here? Why are my animations ignored if inside a List? #BuildInPublic #iosdev #swiftui

When SwiftUI is good its very good.

I was able to add this filter and option button to filter my sidebar list with three different sections. Total time spent perhaps 30 minutes?

Now users can filter the list(s) to quickly find the item they want and they can toggle display of items already contained in groups.

Need to update all my help docs and screenshots but it's worth it.

Continued thread

You can use any view modifiers on any part of the text, as long as it results in a Text for each replacement. This unfortunately won't let you apply background styles (which would have been great for syntax highlighting) since that modifier returns a "some View", but it's pretty decent besides that:
#SwiftUI