steveriggins, So yeah you can pin a #swift 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?
kaiengelhardt, 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, First time I'm using #Swift’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, @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, @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, 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? 😊
ctietze, @davidbures Consistent indentation, nice 👍
shnhrrsn,
pixel, (edited ) “This has come up several times on the forums, but I've never written it up in a standard place, so here it is: There are only three ways to get run-time polymorphism in Swift. Well, three and a half.”
#Swift #Programming #Polymorphism #iOS #macOS #visionOS #watchOS #tvOS
https://belkadan.com/blog/2024/04/Run-time-Polymorphism-in-Swift/
Doozmen, @pixel thanks for writing this up. Do you know how applies to Kotlin? Probably the Java part in your table?
pixel, @Doozmen I didn't write it :)
sean, Sitting in on the #Swift Server Side Meetup stream right now.
sean, "this will blow some people's minds but you can have the compiler tell you about errors before you ship code to production” 🤣
~– @0xTim
davidbures, An interesting Swift question:
Is there a way to pick a random English word from the system dictionary without having to include that entire dictionary in the app bundle?
I’m writing a CLI for some work-related stuff and need a way to generate a random English word. I don’t want to include entire dictionaries within the tool itself, so I thought there might be a way to get a random word from the system dictionary.
dimitribouniol, @davidbures Hopefully its not sandbox restricted or something silly like that!
davidbures, @dimitribouniol Luckily I never use the sandbox 😂
swiftly,
JTostitos, @swiftly some of these examples may be of use to you: https://github.com/pawello2222/WidgetExamples#deeplink-widget
fancypat, Hi #Swift pals, ever wish there was an app just for reading Swift Evolution proposals? Me neither. Anyways, I built one: https://testflight.apple.com/join/qmH8gk0n
It's called Evolreader (because it's for reading Swift Evol-ution... you get it). It downloads the swift-evolution repo to your device so you can read stuff offline. It also saves your progress along the way.
I had fun making it, it's free, and maybe some of you might enjoy it. Here, have some hashtags and screenshots. #swiftlang #iosdev #macdev
patrickmcconnell,
luckkerr, @patrickmcconnell somewhere in that preview you use code that is marked as debug only? Try also surrounding preview with #if DEBUG
ctietze, In #Swift a lot of things are zero-overhead abstractions.
There being no overhead, there's no excuse not to wrap things in your own
structs
except that it's effort.That's the point of this. To spend effort writing the right thing to avoid thinking the wrong thing in the future.
kaybutter, @ctietze This! I do this all the time, even for things like ID types. It’s so much clearer to the pass a UserID type than a string. Especially if you have a lot of other things with ids.
Then the compiler won’t even let you pass the wrong thing in the future.
ctietze, @kaybutter This is such a big strength of Swift.
Being able to verify that you can reduce this to 0 overhead should be such a peace of mind, too
Lobrien, @Migueldeicaza What did you use to write https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot/your-first-extension ? I was thinking of doing Pong Wars to learn #SwiftGodot and writing up my experience. #Swift #SwiftDocs
Migueldeicaza, @Lobrien that’s just Swift DocC, it generates these tutorials for you.
Source code is on the GitHub repository for SwiftGodot
tootsdk, A new release of TootSDK - 3.7.0 📣
https://github.com/TootSDK/TootSDK/releases/tag/3.7.0
What's changed:
- Adds TootClient.deleteProfileAvatar() and TootClient.deleteProfileHeader() @technicat
Community contributions are greatly appreciated 🙌
ryanlintott,
PhilNeal, Helped my good mate @respraycatherine dismantle her c.1911 Swift Bicycle today - the first stage in any #restoration and nearly everything was as it should be thank goodness but we had to have a little giggle at the #chainlink !! #Swift #Cycles of #Coventry #LoopFrame #VintageCycles
davidbures, What helped me the most to write good async functions in Swift is imagining @mattiem and @donnywals looking at me like this
#swift
mattiem, @davidbures @donnywals I’m not sure who this 😅 don’t forget I’m old!
davidbures, @mattiem @donnywals It’s the famous Kid named Finger 😂 https://breakingbad.fandom.com/wiki/Mike_Ehrmantraut
libei,
tootsdk, A new release of TootSDK - 3.4.0 📣
https://github.com/TootSDK/TootSDK/releases/tag/3.4.0
What's changed:
- Allow setting a list as "exclusive" @technicat
Community contributions are greatly appreciated 🙌
danwood, This is pretty fun - in #Swift 5.9 and up, with the ability to use case and if statements to assign, you can very tersely express matching to more than one case of an enum. For example:
bealex, @danwood options are always welcome. This is a simple case, you can probably use even Sets and "contains" even. Switch might be useful if you have associated values.
nicklockwood,
ole, Huge thanks to the Swift team for publishing (and maintaining!) documentation of underscored (and therefore unofficial/private) Swift language attributes. It’s been a big help. https://github.com/apple/swift/blob/main/docs/ReferenceGuides/UnderscoredAttributes.md #Swift #SwiftLang
ole, @schwa Hah, I just came across this again today (in the context of CGFloat). I believe this would allow e.g. moving TopLevelEncoder/Decoder from Combine into the standard library, as was being discussed back in 2020? https://forums.swift.org/t/move-combines-toplevelencoder-and-topleveldecoder-protocols-into-the-standard-library/32494/5
SergKoren,
andhash39, Never change, #swift
brandonhorst, @andhash39 I would use a switch here
mczachurski, I have devoted the last six months to this project. I am very pleased with the result. I know that there are still many things missing. This project also proves that it is possible to do a pretty complex API (server-side) in the Swift programming language. #Swift #SwiftLang #SwiftServer #Vernissage https://mastodon.social/@vernissage/112225820640477556
pylapp, @mczachurski Did you still plan to keep updated and enrich the “Vernissage for Pixelfed” iOS app? :blobcatcoffee:
mczachurski, @pylapp Yes, of course. My aim is to create a very simple platform (along with a new iOS client). A platform that is easy to install, focused on photos, thoroughly tested. And in the future Vernissage for Pixelfed will probably be renamed (to avoid confusion).
phranck, German