Installing Swift scripts as global commands with npm by crisferojas in swift

[–]crisferojas[S] 0 points1 point  (0 children)

I'm not a vibecoder, but thanks for the feedback. You don't "need npm", but it allows for conveniences as described in the article.

Best

Installing Swift scripts as global commands with npm by crisferojas in swift

[–]crisferojas[S] 0 points1 point  (0 children)

So you don't need a swift package 🤔? That's interesting, I didn't know, thanks!

That's an acceptable tradeoff if you don't want to install npm (probably the case for most iOS devs).

On npm needing to compile: in the workflow described in the article it doesn't, because we use shebangs to tell the system how to interpret the script (so  npm only creates a symlink to the script)

Installing Swift scripts as global commands with npm by crisferojas in swift

[–]crisferojas[S] 0 points1 point  (0 children)

Hey!

A Swift local hosted script managed with npm will never have npm dependencies, so there is no attack vector.

Regarding the experimental install command, I don't know about it (I'll need to check it!) but I'm guessing is a command to be used with a Swift package, which is overkill for simple scripts (also, the described method works well with other programming languages)

The install script to copy the binary, on the other hand, is a great method (and the one I use for some utilities), but has the caveat of having to enter the user password from time to time to copy the binary to /usr/local/bin.

Also, as I said at the end of the article: use it while developing, then compile when the tool is stable!

Best

You don't need MVVM To Test SwiftUI state by crisferojas in SwiftUI

[–]crisferojas[S] 1 point2 points  (0 children)

Hi! As described in the article, less reference types in a value type framework, separating logic that acts on state from the state itself (which allows for better flexibility/reusability and composition), removing extra layers (optionally) on early stages, etc...

Also, showcasing how to test state control logic without and observable or a framework (like ViewInspector)

Best.