Starting a new project recently and:
- Wading in to the SwiftData waters and added saving to a context, and I’m impressed. Gave the app an infinite loop at the view layer and we’ll fix that later.
- Doodled a couple candidates for a development and alternate app icon! Someone has to bring a little culture.
- Just that tiny bit of progress today but the momentum is what’s important.

Little clean-ups and place setting / writing plans for the next improvements:
- Fixed that loop lol
- Switched from dataTask completion handlers to Combine's dataTaskPublisher
- TIL don't use @Model var id because that field name is already taken
- Hm that's weird though, the docs say it's persistentModelId but Xcode 15.0.1 gives me id in the definition.
- developer.apple.com/documentat

Tonight:
- Punting on API client safety, moved initial fetch from .onAppear to .task
- Started building Add[Redacted]View for the most common essential data entry to add a new model (UI first, data later). Forms and pickers!
- Removed unused code
- 🎶 Lots of Avett Brothers and feelings

Today:
- Added a preview for the first Form view
- Fixed preview for main view (need to add mock user data)
- Writing notes to connect model work with submitting this form
- Took a detour to build out fetching account info and then returned to pre-populate the form
- Hit a 401 when requesting account info
- Figured out I need to use the accessToken from the token body response
- Pre-filled that info on the form
- Display user's name on main page
- Lots more // TODO

jack

@j4ck@iosdev.space

Tonight:
- Added more data types
- Added more Form UI
- Moved Form State vars into actual model
- Picker

November 11, 2023 at 2:13:45 AM
(Edited)

I am doing _something_ wrong that's crashing my Previews.

I have an @Observable class Client that accepts SwiftData.ModelContext as various function parameters. Client is passed through @State/.environment(client).

My view will invoke client.doWork(modelContext) and that works well enough when running but something completely implodes in Previews. Doing any access on SwiftData.query and/or this Environment(Client.self) is wrecking this preview.

Show Full thread

Today
- No luck with my previews yet (likely have to mock out API client)
- add parsing/serializing idempotency test to main model (failing)
- add suggestions list for Manufacturer field with network fetch and SwiftData storage (pretty useful!) (more work to connect selection to main model)
- add KeychainSwift dependency
- add AuthenticatedUser (new) owns User (existing)
- add keychain caching for OAuth token — auto-login if the session is still valid!

Today 2:
- failing to set up a server instance locally
(must have a dev server to spare polluting production)
- more on this later

Codable + network API

Elk Logo

Welcome to Elk!

Elk is a nimble Mastodon web client. You can login to your Mastodon account and use it to interact with the fediverse.

Expect some bugs and missing features here and there. Elk is Open Source and we're actively improving it as a community project. Join us and let's build it together!

If you'd like to report a bug, help us testing, give feedback, or contribute, reach out to us on GitHub and get involved.

To boost development, you can sponsor the Team through GitHub Sponsors. We hope you enjoy Elk!

Daniel RoeTAKAHASHI ShuujiJoaquín Sánchez三咲智子 Kevin DengAnthony FuPatak

The Elk Team