Swift

davidbures,
@davidbures@mstdn.social avatar

Update on the categorized cached downloads (https://mstdn.social/@davidbures/112456702745516734):

Now, it also works when the name of the installed package is not exactly the same as the name of the cached download!

davidbures,
@davidbures@mstdn.social avatar
  • If a package needs sudo to update (this is something I don’t have to skills to implement and have been looking for help with for years)
  • If an update failed completely. It will give you a reason for the failure, which you should then follow (2/2)
phranck,
@phranck@chaos.social avatar

@davidbures Weird thing. I got this error before. I uninstalled the sonixd package and now the same error appears again, although the package no longer exists.

natpanferova,
@natpanferova@mastodon.cloud avatar

Sorting data by multiple criteria can be complex, but Swift's built-in tuple comparison feature simplifies the process. Using tuple comparison, we can efficiently sort and organize data by various fields. Check out my new post to learn how: https://nilcoalescing.com/blog/MultiCriteriaDataSortingWithTuples

hamish,
@hamish@hachyderm.io avatar

@jamesdempsey @natpanferova @schwa

That's for the conformance, a bunch of overloads of < for different tuple arities were added all the way back in Swift 2.2 https://github.com/apple/swift-evolution/blob/main/proposals/0015-tuple-comparison-operators.md

schwa,
@schwa@mastodon.social avatar

@hamish @jamesdempsey @natpanferova what I really want is hashable for tuples of different types.

StewartLynch,
@StewartLynch@iosdev.space avatar

Check out the talk I had to cancel at There might be a nugget here that would surprise you. Check out the links in the description to go directly to a specific or nugget

Deep Dish Swift Presentation
https://youtu.be/_XZHzl3R1Fo

davidbures,
@davidbures@mstdn.social avatar

@StewartLynch I watched the talk and it was very insightful! My favorite part was the Bindable technique right at the start. When I first started learning about Observation, I also thought the Bindable thing was some sort of an oversight… regardless, thanks for the great talk 😉

phranck, German
@phranck@chaos.social avatar

Does anyone know of a tool that analyses Xcode projects and then provides me with statistics on lines of code etc.? In any case, it should also take into account Swift packages used.

Any suggestions?

leberwurstsaft,
@leberwurstsaft@mastodon.social avatar

@phranck I use tokei for code counting purposes. It’s very fast, has enough options for me.

https://github.com/XAMPPRocky/tokei

phranck,
@phranck@chaos.social avatar

@leberwurstsaft Sehr cool, das Tool!

davidbures,
@davidbures@mstdn.social avatar

Will I spend an hour doing a tedious task? No, I'd rather spend a week writing an app to do it for me.

Anyway, I'll be posting about my next small utility app for macOS, StringsMerge, which will let you merge two conflicting .xcstrings files.

#swift #swiftUI #macOS #opensource #buildinpublic #macdev

cheekbathmediasalad,

@davidbures

This is the way.

davidbures,
@davidbures@mstdn.social avatar

Thanks to @dimitribouniol and @glacials, we're much closer to the next Cork release! I was finally able to implement the first version of a self-compiled check, which was the only requirement left for the next release.

As promised, both Dimitri and Ben will be getting either a free Cork license or the cash equivalent, as well as a special shoutout in the contributors sections once the feature is fully implemented.

#swift #swiftUI #macOS #opensource #buildinpublic #macdev #homebrew #CorkApp

davidbures,
@davidbures@mstdn.social avatar

I used to use GitHub sponsors, but I ran into massive limitations. What I’d recommend is to use an automation system like n8n to react to webhooks that Stripe sends to add users, then also using a different n8n workflow for the verification (which is also what I use) (2/3)

davidbures,
@davidbures@mstdn.social avatar

You can hit up the n8n workflow every time the user tries generating something, the workflow will then check a database for the relevant user info (like the number of tokens) and maybe even generate the response. Then, you can use another workflow to update the database.

That’s about an overview of what I’d do 🤔 Tell me if you have any other questions 😊 I’m far from an expert though (3/3)

davidbures,
@davidbures@mstdn.social avatar

Earlier today, I shared the first prototype of starting and stopping services in Cork.

I've made some adjustments to it, including polishing up the progress indicator, and I think it looks pretty alright.

What do you think?

(@troz here's that 2nd part 😉)

Video of new Homebrew service starting workflow

davidbures, (edited )
@davidbures@mstdn.social avatar

As for having the service name in the button, I’ve read somewhere that it’s better to be explicit in the buttons so that the user doesn’t have to look up at the service name and then back to the button to figure out which service that button will actually modify. All the buttons in Cork follow this system; maybe it’s a bit awkward and noticeable due to the two buttons being next to each other, so let’s see what can be done about that (2/3)

davidbures,
@davidbures@mstdn.social avatar

@arnan @troz Impossible, right? 😂 Anyway, I created Cork so that you could do everything in Homebrew without the terminal. It’s written in SwiftUI for macOS 13+. It using SwiftUI is sometimes a bit awkward, but I do my best to make it work.

There’s a quick overview of the features on the website: https://corkmac.app

You can also browse the source code here: https://github.com/buresdv/Cork

You can compile the app yourself for free, or buy the app for a one-time price of 25€

tootsdk,
@tootsdk@iosdev.space avatar

A new release of TootSDK - 3.10.0 📣

https://github.com/TootSDK/TootSDK/releases/tag/3.10.0

What's changed:

  • Add report, signup and severed relationship notification types @luckkerr

Community contributions are greatly appreciated 🙌

#iOSDev #Swift #TootSDK #Fediverse

kern,
@kern@iosdev.space avatar

Hello Fediverse!

I grew up programming in Applesoft Basic, and now I spend my days writing apps for Apple products.

I’m looking for my next role part-time or full-time. Please get in touch if you would like to work with me!

davidbures,
@davidbures@mstdn.social avatar

I really need some Swift help. If you’re feeling brave, could you check out this Cork issue? https://github.com/buresdv/Cork/issues/275

We’re having trouble with the “Somehow bypass this licensing scheme if the user compiled Cork themselves” part

Do you have any ideas on how to solve this? If you do and you help implement it, you’ll get a spot in the “Special thanks” section of the readme and within the app itself, as well as a free license or cash equivalent of the license

glacials,
@glacials@hachyderm.io avatar
davidbures,
@davidbures@mstdn.social avatar

@glacials @dimitribouniol Thanks a lot!

natpanferova,
@natpanferova@mastodon.cloud avatar

Exciting news! I just released a new book called "Swift Gems" 📚✨

The book consists of a large collection of advanced Swift language techniques gathered and tested over the years, tailored for experienced developers.

Please, check it out: https://books.nilcoalescing.com/swift-gems

All the tips in the book are focused on Swift and Swift Standard Library, so they can be applied to any platform, from iOS and macOS to Swift on the server.

#Swift #SwiftLang #iOSDev

StewartLynch,
@StewartLynch@iosdev.space avatar

@natpanferova Another instant purchase

jamesrandall,
@jamesrandall@mastodon.social avatar

Voxel editor coming along nicely now. Video is taken on the Mac but it also works on the iPad.

I've spent surprisingly little time on this. 20 hours total tops. Its amazing what you can get done with good quality tools, consistency (I normally do an hour pre and post dog walk), and a good set of fundamentals (its really making use of things I've learned in the last year or so). #swift #swiftui #metal

https://youtu.be/R6htZe4Lmjc

ctietze,
@ctietze@mastodon.social avatar

@jamesrandall Oh yes please, a "Mac-assed" Voxel editor sounds great. Video demo looks buttery smooth already :)

I don't know how people adapt to the MagicaVoxel shortcuts and UX

jamesrandall,
@jamesrandall@mastodon.social avatar

@ctietze I’ve been working on voxel buildings for a city builder and wanted something a bit more to my tastes for creating them so figured I’d see what I could do! Hopefully useful to others too.

finestructure, (edited )
@finestructure@mastodon.social avatar
rauhul,
@rauhul@hachyderm.io avatar

@dgregor79 @finestructure so... can we use this on macOS? I dislike having to use swift.org to download new nightly toolchains.

finestructure,
@finestructure@mastodon.social avatar

@rauhul Unfortunately swiftly is Linux only for the moment, although it will support macOS eventually.

kenji, German
@kenji@chaos.social avatar

#Eventim-Nutzer sollen #Passwörter ändern - Daten aus dem #Darknet wurden eingesetzt, um Ticketverkäufe für #Taylor #Swift-Konzert in Deutschland zu manipulieren:

"Wie die Ticket-Plattform Eventim mitteilt, hätten in den letzten Tagen unbekannte Kriminelle versucht, sich unautorisiert Zugang zu Konten von Nutzerinnen und Nutzer zu verschaffen, um in den Besitz von Karten für Swifts "The Eras Tour" zu gelangen - und diese dann weiterzuverkaufen."

https://www.n-tv.de/leute/Hacker-machen-Fans-von-Taylor-Swift-nervoes-article24924816.html

piotrekjeremicz,
@piotrekjeremicz@mastodon.social avatar

Today is my 32nd birthday! 🥳🎂🎉

Exactly a year ago, on my previous birthday, I added a cake symbol to the app. Today it symbolizes the day of opening an account in BeforeDaily.

The funny thing is that the first commit that I found was made in July 2022. 😅

Stay up to date with #swift, #swiftui, #iOS and #macos with BeforeDaily!

ctietze,
@ctietze@mastodon.social avatar

@piotrekjeremicz Happy birthday 🍰

piotrekjeremicz,
@piotrekjeremicz@mastodon.social avatar

@ctietze thank you so much!

jonduenas,
@jonduenas@mastodon.world avatar

Alright, might be time to abstract in my app. Who has the best example? Should I use a ModelActor? Would a class holding a ModelContainer be sufficient if I create a new ModelContext inside the CRUD functions?

jonduenas,
@jonduenas@mastodon.world avatar

@davidbures Lol I’m mostly trying to extract my reliance on SwiftData everywhere. If something causes the ModelContainer to fail to initialize, my app still has functionality to offer. In fact, free users don’t even access the database at all. So, doesn’t make sense to fatalError or block the entire app loading. “Abstraction” is probably a step past what I need though, so maybe I should ask for examples of moving SwiftData out of SwiftUI first.

davidbures,
@davidbures@mstdn.social avatar

@jonduenas That’s fair 😁 This is actually something I’m interested in myself

jerrodputman,
@jerrodputman@mastodon.gamedev.place avatar

I managed to get a little something running on a Pimoroni PicoSystem using Embedded !

The PicoSystem uses an RP2040, so I was able to use the embedded examples from Apple to get started.

The demo is using the PicoSystem SDK on top of the Pico SDK. I had to work around the C++ name mangling differences between g++ and Clang by making a thin C wrapper.

I’ll be publishing the code somewhere soon, and hope to have a more interesting demo eventually.

A Pimoroni PicoSystem running an Embedded Swift demo, which has a bouncing apple next to the text “Hello, Swift!”

jerrodputman,
@jerrodputman@mastodon.gamedev.place avatar

As promised, here’s the project source. https://github.com/jerrodputman/swift-picosystem-example

I’d still like to find a solution that doesn’t require a C wrapper. Perhaps building the PicoSystem SDK with Clang would work? The Pico SDK has issues with Clang, out of the box at least.

#Swift #SwiftLang #embedded

fbartho,
@fbartho@mastodon.social avatar

I’m trying to make a #swift package that vends at least two libraries.

The package builds each library fine, and I had no problem importing the first library into my app, but when I try to import the second library, it tells me “Cannot find ‘Foo’ in package. Did you mean ‘Foo’”

I’ve been fighting this for a few days. Any advice or pointers to projects I can learn from? #SwiftPM

fbartho,
@fbartho@mastodon.social avatar

@finestructure As I was cleaning up my code to try to share it, I got a different error-message.

Specifying the package: “PackName” in my .product dependency line solved my issue.

I guess the problem was that I had an implicit package name, and in the working case swiftpm was reading the ProductName & implicitly assuming that was also the PackageName.

The working case happened to be a library that matched the name of the root folder. So everything failed only on the second lib.

Thank you!

finestructure,
@finestructure@mastodon.social avatar

@fbartho Glad to hear you figured it out!

Jeehut,
@Jeehut@iosdev.space avatar

It's that time again: For the next 2 days or so I'll be reading through 164 threads on the #Swift Forums so you don't have to! 📚

Subscribe to my @SwiftEvolutionM newsletter to get my summary of the last 3 months in a couple of days. It's free! 👇
https://swiftevolution.substack.com

video/mp4

below, German
@below@mastodon.social avatar

Can anyone tell me why this is landing at fatalError?

guard let a = someArray.first else {
return
}
self.someVar = a
guard self.someVar == a else {
fatalError("What?")
}

This is in the init method of a SwiftUI View, if that makes any difference …

#swift #iosdev #macdev

below,
@below@mastodon.social avatar

@dimitribouniol Thanks! Now what did I not read to tell me this?

dimitribouniol,
@dimitribouniol@mastodon.social avatar

@below Honestly, not sure its super well documented on Apple's side. Basically, @State is a reference to some internal storage SwiftUI manages on your behalf, and can change depending on where it's called. This is how Views which are structs can refer to the same value over time. It's generally only valid to reference somewhere within a body call, which is why you can set it in onAppear or in closures that capture it, because they are capturing the up to date ref which is not available in init

slothdude,
@slothdude@mastodon.online avatar

I ran into a weird #swift issue today. I am organising our codebase to use local packages for various things. I have an error enum defined in a local package. There is a class in the main application target that throws the error. But when I try to check that the error is correctly thrown in a unit test, the catch doesn’t capture it. Trying to print the type and value with the help of type(of:) does give the correct looking result. I even tried with the full type including the module name.

luckkerr,
@luckkerr@mastodon.world avatar

@slothdude I had the same issue. In my case the problem was due to that package being added as linked library both to main target and unit test target. Keeping it only for main target fixed it.

steveriggins,
@steveriggins@mastodon.social avatar

So yeah you can pin a package manager package to a reference, but that doesn’t pin any dependencies it has.

How are people locking down the entire SPM tree for security purposes?

finestructure,
@finestructure@mastodon.social avatar

@steveriggins Commit your Package.resolved and compile with --disable-automatic-resolution. This will make the build break if there's drift between what the manifest specifies and what resolved has locked in.

kaiengelhardt,
@kaiengelhardt@mastodon.social avatar

I have just open sourced a small #Swift package with convenience APIs for Auto Layout.

It‘s called Consti and you can find it on Github: https://github.com/kaiengelhardt/Consti.

I‘ve been using these convenience APIs in all my projects for years. Never had any need for a more complex Auto Layout replacement like SnapKit for example.

Jeehut,
@Jeehut@iosdev.space avatar

First time I'm using ’s async-let in my apps, can you help me understand what's going on? 👨‍💻

I expect that (1) and (2) run in parallel. But (3+) probably is sequential, cause I'm calling "try await" inside the loop, right? 🤔

How to fix that? Is there a simple way? 💪

Jeehut,
@Jeehut@iosdev.space avatar

@cocoaphony So there is no syntactic sugar for running an array of tasks? I wanted to avoid TaskGroup because it’s so much boilerplate.

I think I will keep it sequential then. Most people only have one Subscription Group anyway. 🤷‍♂️

finestructure,
@finestructure@mastodon.social avatar

@Jeehut @cocoaphony TaskGroup is for an indeterminate number of tasks, async let for when you have a fixed number. Give TaskGroup a try, it looks more boilerplate-ty than it actually is!

davidbures,
@davidbures@mstdn.social avatar

I'm working on my first CLI app built with Swift in ages (the only other CLI app I made was my very first Swift app in 2020).

What do you think of the way the output looks? 😊

#swift #Programming #macdev #OpenSource

ctietze,
@ctietze@mastodon.social avatar

@davidbures Consistent indentation, nice 👍

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