helvede.net is one of the many independent Mastodon servers you can use to participate in the fediverse.
Velkommen til Helvede, fediversets hotteste instance! Vi er en queerfeministisk server, der shitposter i den 9. cirkel. Welcome to Hell, We’re a DK-based queerfeminist server. Read our server rules!

Server stats:

161
active users

#swiftui

5 posts5 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.

@nerdd

Answer from Perplexity:

To fix this issue, replace unsupported types with alternatives that SwiftData can handle:

For Duration: Use TimeInterval instead, as it is supported by SwiftData.

For Color.Resolved: Avoid using it directly in your models. Instead, store color-related data in a format like RGB values or another supported type.

This ensures compatibility with SwiftData's encoding requirements.

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.

Replied in thread

Today:
- Merged QR Sticker universal links esupport!
- Very pleased with this new test suite: ViewModel unit tests and a small start for UI tests on universal links.
- Waiting for v1.3 App Review 😇 and integration testing soon 😁

(Sorry for two links which some clients don't display well but…)
1. How to use Bike Index QR Stickers -- order yours today! bikeindex.org/info/how-to-use-
2. Pull request with a mad-scientist Mermaid 🧜‍♀️ state diagram github.com/bikeindex/bike_inde

Bike Index · How to use Bike Index QR stickersClaim and protect your bike with a Bike Index QR sticker

Just moved over from mastodon.design, so it's time for another #introduction!

I'm Toni 👋

I’m a software #designer, though I’m spending more and more time writing code, mostly in #swiftui and #react

When I'm not heads down at work, you'll catch me #cycling, eating my weight in oranges, walking with my dog Xenon, or just getting lost in a new #book, #anime, or #manga.

I’m also a passionate #yugioh collector, #nba fan and I play #guitar occasionally.

More🍊toni.li/about

Once again I have stumbled onto something I don’t understand.

In the entry point for my app I set a NavigationContext in the environment, and when I run the app and navigate between views, at some random point, it throws the error in the second image, and the debugger indicates it is on the “struct FooApp: App {“ line.

What is going on? Help!

In the subviews I am accessing the context from the env like so: “@ Environment(NavigationContext.self) var context”.

Replied in thread

Hm, are "Development Assets" broken on Xcode 16? I had it working before but haven't look at this preview data in a while.

I have Development Assets > json file, scanning Bundle.allBundles is not able to load this. Maybe this broke during my Convert To Folder change? This article from October is the only one I've found discussing loading json files (with the scan allBundles approach). medium.com/@wesleymatlock/how-
#iOSDev #SwiftUI #BuildInPublic

Medium · How to Use SwiftUI’s Preview Content with the #Preview MacroBy Wesley Matlock
Continued thread

Bingo! This was what I was looking for:

mastodon.social/@__mbh__/11420

By changing the `TimingSession.duration` to a `Duration` (much better alignment of name and type as well), I can now declaratively format the duration like so:

`Text(timingSession.duration, format: .time(pattern: .hourMinuteSecond(padHourToLength: 2)))`

MastodonMichael Bech Hansen (@__mbh__@mastodon.social)@nerdd@mstdn.social good reference site, and a better way of formatting: https://fuckingformatstyle.com/duration-styles/#time-style