Software Dev

The SwiftUI trigger-value pattern

As noted in Swift with Majid, the trigger-value pattern is becoming a thing in SwiftUI.

👉 Trigger value pattern in SwiftUI

Basically, this pattern lets you “trigger” some user experience when some specified data changes.

In one example, when a list of messages changes, then the app automatically immediately trigger some haptic/sensory feedback. And it only takes one extra line of code.

    .sensoryFeedback(.impact, trigger: messages)

The post gives another example of flashing the scroll indicator in the same manner.

And it goes into making your own custom triggers.

This is cool stuff and such a simple + powerful way to make your app more responsive.

Software Dev

The Elm Architecture

I’ve been trying to understand the Elm Architecture for a new iOS project. I kept reading over this article and thinking, “Wait a minute…. What’s the catch here? This seems too simple.” 🧐

👉 The Elm Architecture: Simple, yet powerful – An overview by example

I like that this architecture can be explained in a very short post with examples.

The beauty of The Elm Architecture lies in its simplicity.

That article is simple but assumes a web UI and explicit mentions HTML 🙄. Here is a funnier and more useful article about Elm for iOS. 😂

👉 Elm architecture in iOS: Why you don’t need shit like RxSwift or MVVM

Elm architecture can be described as follows

msg -> Model -> View -> msg

I even made my own diagram just to make sure I “got” it. The devil is in the details, but I think this is right. 🤷🏻‍♂️ It definitely seems simpler than VIPER.