@ctietze@mastodon.social
@ctietze@mastodon.social avatar

ctietze

@ctietze@mastodon.social

Developer of indie macOS apps. The Archive, WordCounter, TableFlip, Move!

Using #Xcode to write #Swift and sometimes #SwiftUI apps for #iOS and #Mac.

OG #Zettelkasten zealot.
Local #urbansketchers group founder.

#Bielefeld (Germany)

─────────────
#fedi22

This profile is from a federated server and may be incomplete. Browse more on the original instance.

ctietze, to random
@ctietze@mastodon.social avatar

SwiftUI.View Is Your ViewModel https://christiantietze.de/posts/2023/08/swiftui-view-is-your-viewmodel/

Hot 🔥 Take:

SwiftUI.View is actually a view model – a model of the view. It’s a blueprint for what to display, but doesn’t contain any actual pixel drawing.


There should be interesting consequences when you start with this assumption. I'll report back!

ctietze, to SwiftUI
@ctietze@mastodon.social avatar

SwiftUI Challenge: 🏆

Can You Port this from to ? Does it take you 10 minutes (like Auto Layout), less or more?

https://christiantietze.de/posts/2024/03/swiftui-challenge-port-from-auto-layout-to-swiftui

Share your solutions! 🔥

ctietze, to SwiftUI
@ctietze@mastodon.social avatar

question:

StateObject is about ownership;
ObservedObject about, well observing.

What if I inject the instance for the, let's say, "View Model" into the View's initialzier?

Does it still require usage of the StateObject property wrapper, or does ObservedObject somehow magically do the trick?

Asking because a lot of samples use ObservedObject for this case even though the view owns the reference.

ctietze, to random
@ctietze@mastodon.social avatar

"Stop using for "
https://developer.apple.com/forums/thread/699003

I'm not sure if this is, a polemic, a joke, or meant as serious advice.

It's a huge forum thread with 90% images of slides and sample code.

I do get that Model + View suffice for Apple's sample apps, but then you throw out the testing baby with the bathwater completely, for example 🤔

ctietze, to swift
@ctietze@mastodon.social avatar

async/await question:

What are the patterns/conventions to expose async closures in one place, and handle getting back to the main queue in another?

Context:

The Xcode warning here makes perfect sense:

"""
Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
"""

A dummy implementation of an async throws closure modified an view model directly. (It's annotated MainActor.)

ctietze, to SwiftUI
@ctietze@mastodon.social avatar

The bad awakening in StateObject trickery:

init(foo: Foo) {
_foo = .init(wrappedValue: foo)
}

If this view is in a ViewBuilder that tries to update a lot, the Foo created on the outside will be initialized and then discarded immediately after.

ctietze, (edited ) to SwiftUI
@ctietze@mastodon.social avatar

This is the WWDC21 NavigationCookbook demo app that shows the then new NavigationSplitView in action.

The toolbar transitions are horrible!

I believed I did something wrong, but it's the framework 😩

ctietze, to random
@ctietze@mastodon.social avatar

I wonder when I can overcome myself and delete TextMate.

ctietze, to random
@ctietze@mastodon.social avatar

@xenodium I have a friend who isn't into Emacs (couldn't bear to stay in it), but loves the idea of Org-Mode.

What do you think about a "Plain Org" Catalyst release so it runs on macOS, too, for filtering and overviews? Do you think that would work? 🤔 The .org file would still be there to dive into

ctietze, to random
@ctietze@mastodon.social avatar

Things are coming together!

Thanks to tree-sitter, and using Neon as the plumbing, JavaScript highlighting now just works.

Looks almost like a real editor now.

https://github.com/ChimeHQ/Neon

ctietze, to random
@ctietze@mastodon.social avatar

async/await question:

This function produces one (1) array of results asynchronously:

func doTheThing() async -> [Result]

How would you write a (search/fetch/...) service that produces results in batches? E.g. if there are multiple data sources?

Am thinking of RxSwift's window.

Maybe return an array of the array of results, aka an AsyncSequence?

Or AsyncStream? 🤔

ctietze, to php
@ctietze@mastodon.social avatar

A question for more experienced #PHP developers than me:

We have this setup where all requests go through a PHP script for authorization (think: cookie) checking before serving files.

That's fine with HTML, but less ideal for 5MB PDFs.

I'm trying to search for ways to use PHP to allow/deny access, but otherwise let the web server (Apache) do its job.

Is there such a facility to rewrite requests for auth, but then go on serve the static files?

ctietze, to random
@ctietze@mastodon.social avatar

Masterclass of Decoupling: Diablo II Resurrected https://christiantietze.de/posts/2024/04/masterclass-of-decoupling-diablo-ii-resurrected/

This was totally unexpected: the Diablo II remaster doesn't just ship same-ish gameplay with new graphics. They actually decoupled the graphics engine to render at 60 FPS from the (old) game engine to not replicate, but actually preserve the exact game feel.

If the D2 team pulled that off, how hard can decoupling our apps be )

ctietze, to macos
@ctietze@mastodon.social avatar

Sometimes, this language selection thingie appears on (even during games of StarCraft II) and I can't reliably get rid of it with keyboard shortcuts. Escape, backspace, it doesn't always help.

It now appeared while I was away from my desk for 5min but the text field was selected.

ctietze, to random
@ctietze@mastodon.social avatar

Based on a condition, I want to make sure an element is either part of a set or removed from it.

(Like a toggle, but conditional on a Bool expression, not on the previous value.)

How would you call this?

extension Set {  
 mutating func foo(  
 _ element: Element,  
 insertWhen condition: Bool  
 ) {  
 if condition {  
 insert(element)  
 } else {  
 remove(element)  
 }  
 }  
}  

ctietze, to random
@ctietze@mastodon.social avatar

"We tried that, didn’t work" https://world.hey.com/dhh/we-tried-that-didn-t-work-d9c42fe1

I need to dig into DHH's JavaScript topic more, because it feels right up my alley, and I also don't have a clue about modern browser's JS. This sounds refreshingly ... not bad!

ctietze, to swift
@ctietze@mastodon.social avatar

package recommendation question:

Say I want a simple JavaScript syntax highlighter for NSTextView, what would you recommend nowadays?

ctietze, to swift
@ctietze@mastodon.social avatar

I have a question!

Never wrote my own Publisher. Always combined others.

But this once, I believe that it would be nicer to have a struct instead of a function.

So I wrote a Combine.Publishers.Either type, but now I'm not sure if that's all there is, really.

https://gist.github.com/DivineDominion/de85d2dc3d42f6ebfe29f1d35a3c7da3

Feedback very much appreciated! 🙏

ctietze, to random
@ctietze@mastodon.social avatar

Irregular update on my 93 y.o. grandmother's situation with regard to being able to use any modern device:

It's still impossible.

Try to listen to audio books in a hospital if you can't see well and screens don't work for you.

Try to use devices that require "normal" button presses, but your finger tips are too numb to register the button's bumps or tactile feedback.

~89.7% of the devices are touch-first or touch-only. The rest is also unusable.

You know what still works?

Tape decks.

ctietze, to random
@ctietze@mastodon.social avatar

What do good web site admins use to track stats and referrers?

Currently I'm downloading web.log files and run AWStats locally, but that sucks, and collaborators can't peek at monthly stats before I do so.

ctietze, to coffee
@ctietze@mastodon.social avatar
ctietze, to random
@ctietze@mastodon.social avatar

I'm a bit behind on iPhone architectures and find this to be weirdly hard to google --

Simulator:
Is i386 architecture (32bit I believe) gone for good by now?
Is x86_64 for iOS the new default?

Device:
Is arm64 the only one left?

Asking because old build scripts of an open source library contained many architectures and I run into build issues

ctietze, to random
@ctietze@mastodon.social avatar

Today the Mac wouldn't start. Recory options also don't load at all.
That's going to be a fun morning

ctietze, to swift
@ctietze@mastodon.social avatar

fam and lazyweb enthusiasts,

to kickstart a research project, do you have a link handy to limit Swift code to execute on a particular thread (!) that works on macOS 11+?

ctietze, to random
@ctietze@mastodon.social avatar

Dropbox spooks users with new AI features that send data to OpenAI when used | Ars Technica https://arstechnica.com/information-technology/2023/12/dropbox-spooks-users-by-sending-data-to-openai-for-ai-search-features/

Wow. Dropbox just gets creepier and creepier as time goes by.

I'm a happy convert.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • tester
  • ngwrru68w68
  • Youngstown
  • tacticalgear
  • osvaldo12
  • slotface
  • PowerRangers
  • hgfsjryuu7
  • khanakhh
  • kavyap
  • tsrsr
  • InstantRegret
  • DreamBathrooms
  • everett
  • Leos
  • magazineikmin
  • rosin
  • modclub
  • thenastyranch
  • vwfavf
  • GTA5RPClips
  • Durango
  • ethstaker
  • mdbf
  • normalnudes
  • cubers
  • cisconetworking
  • anitta
  • All magazines