mastodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance, open to everyone, but mainly English and French speaking.

Administered by:

Server stats:

812
active users

#swiftui

41 posts36 participants0 posts today

A ViewModel is a very specific concept. If you think you need a ViewModel in #SwiftUI (probably not necessary because SwiftUI has formatters like AppKit), I'm pretty sure it should be a struct (representing the projection of the actual model to the values required by the View).
Not, ever, a StateObject.

If any Boston-area #CircuitPython friends would like to come out to Boston College Arts Fest, Sat. April 26, my students are presenting 1-3pm both Physical Computing & #SwiftUI projects in the new MakerSpace building 245 Beacon St. Room 301. No pressure, but would love to see you there if interested & able! @blitzcitydiy @ecken @danhalbert. All welcome! bc.edu/content/bc-web/sites/bc

Boston CollegeArts Festival 2025Boston College's annual celebration of the arts takes place April 24–26

I’ve got so many mastodon posts bookmarked, I’ve been trying to find a why to manage them all. So I’ve started building a little iOS app which will let the user tag the bookmarks and also add them to folders.

Cue the influx of people telling me there is ways to do that already 😅

If anyone has any ideas for other handy features, I’m all ears.

When displaying a custom image in SwiftUI, if the image name is included in a string catalog or Localizable.strings, SwiftUI will automatically apply the localized string as the accessibility label, with no need for the accessibilityLabel() modifier. #iOSDev #SwiftUI
nilcoalescing.com/blog/ImageAc

Nil CoalescingAutomatic image accessibility labels from localized strings in SwiftUISwiftUI uses a localized string matching the image name as the accessibility label, without needing to apply the accessibilityLabel() modifier.

A simple thing that I do all the time in SwiftUI: apply a .border(.red, width: 1.0) to views to make sure the layout meets my expectations. If there are several views, I use different colors. Sometimes, this reveals interesting situations.

macOS: Applying vertical .fixedSize to Text adds huge margins above and below for no apparent reason

Apple folks: FB17238588

Is there any other way that actually works of avoiding cropping text in SwiftUI on macOS? .lineLimit(nil) is not included in the "actually works" bag of solutions. The only way I can fix this is wrapping everything in a ScrollView but that is obviously not ideal.

SwiftUI includes several ways to change the color of text, including foregroundStyle(), tint(), AttributedString, and textRenderer() for advanced cases. My new blog post walks through how they work and which approach to choose for different use cases: nilcoalescing.com/blog/Foregro
#SwiftUI #iOSDev

Nil CoalescingWays to customize text color in SwiftUISwiftUI offers several methods to change the color of text, including foregroundStyle() and tint() modifiers, AttributedString attributes, and the textRenderer() API for advanced styling.