Swift

RobW, (edited )
@RobW@iosdev.space avatar

Using MusicKit how can I get a tracks release year?
As far as I can tell releaseDate is always nil, do I need to make a further request to populate this property?
A track always contains a releaseYear property so far as I can tell, but this is not exposed, as in I can't do myTrack.releaseYear

This is for a personal project, so I don't mind a hacky solution if that's what it takes.
#swift #musickit

RobW,
@RobW@iosdev.space avatar

It seems I can get this data easily using the JSON API, just not with the Swift MusicKit. Also it seems the IDs that the Swift library uses are different to the ones the API uses, meaning I have to re-write everything. So... fun.

RobW,
@RobW@iosdev.space avatar

On the off chance this is useful to anyone else - the ID I had is returned from a playlist, meaning its an ID for a track in my library, not for a track in the Apple Music catalog. So although the data is the same, you have to make a request to the library not the catalog.
I think I now have this sorted with minimal changes needed to my existing code. Although it did take a lot of fiddling around.

younata,
@younata@hachyderm.io avatar

I tested the advice that marking classes in as final improves build times. I generated 2 swift files that each have 1000 (trivial) classes: one with each marked as final, the other without. I built each file 10 times, recording the build time for that file.

Marking classes as final does improve build times. By about 7%. The difference is just outside 1 standard deviation, so I think it’s statistically significant. But I’m not a trained statistician.

I used Xcode 15.2/swift 5.9 for this.

davidbures,
@davidbures@mstdn.social avatar

OH MY GOD I CAN'T BELIEVE I FINALLY FIGURED IT OUT!! The next Cork release will be fucking EPIC

(Cork now supports packages that require sudo during install/uninstall)

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

A demo showing new support for packages requiring sudo in Cork

jonathantrott,
@jonathantrott@mastodon.au avatar

@davidbures Seems to have got stuck afterwards though....

davidbures,
@davidbures@mstdn.social avatar

@jonathantrott That strange, did you try any other package? I know the zulu JDKs and Microsoft teams also require sudo

davidbures,
@davidbures@mstdn.social avatar

What, in your opinion, is the worst page in Apple's developer docs?

For me, it's LocalizedError:
https://developer.apple.com/documentation/foundation/localizederror

It's not completely empty, but it has absolutely no useful info, which makes it even worse than if it was completely empty.

swiftly,

@davidbures this one is not THE worst, but it’s pretty poor https://developer.apple.com/documentation/coreaudio

davidbures,
@davidbures@mstdn.social avatar

@swiftly Oh yeah, I can see why

thatvirtualboy,
@thatvirtualboy@techhub.social avatar

App Review rejected my macOS menu bar app, Done, because the “app menu is missing the required Quit option.“

However, the app allows a quit operation by right clicking the menu bar app icon and choosing quit. Do menu bar apps usually support other methods to quit? Is it possible they didn’t try this?

#iOSDev #swift

JTostitos,
@JTostitos@techhub.social avatar

@thatvirtualboy annoying, but probably just explaining and including that screenshot will solve it. Unless they wanted you to upload a new binary… 🫠

thatvirtualboy,
@thatvirtualboy@techhub.social avatar

@JTostitos Hopefully that’s all it’ll take! If so, we could be seeing Done on the App Store reeaaaaaaal soon

Krupp,
@Krupp@hci.social avatar

If you are looking for a weather app that is simple and does not track your location, try Ducky Weather! One thing I have found in our research group is that the most popular free weather applications send your location to trackers and I wanted to create an app that does not do that. Because it uses NWS data, it is only available in the US.

More features to come but suggestions are welcome!

https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=6474254666

finestructure,
@finestructure@mastodon.social avatar

My first package build / test run ever on 🚀

It’s actually quite easy to get started thanks to winget. Use it to install the dependencies (git, python, VS Studio 2022) and then Swift itself

winget install --id Swift.Toolchain -e

and off you go! 🎉

finestructure,
@finestructure@mastodon.social avatar

The main obstacle to make this happen was to trick myself into buying a Windows machine by rekindling my love for video games via a very delightful detour called the .

dandylyons,
@dandylyons@iosdev.space avatar

@finestructure Sounds like the game porting toolkit accidentally ported you to Windows.

nicoreese,
@nicoreese@mastodon.social avatar

If I want to use String(localized:) to localize a variable, is this the best way? I can’t put it in directly like I used to with NSLocalizedString. In this case, the variable comes from Core Data, otherwise I could probably declare it directly as LocalizedStringResource. #Swift #SwiftUI #UIKit #Localization

MuseumShuffle,
@MuseumShuffle@mastodon.social avatar
ktoso,
@ktoso@mastodon.social avatar

Want to with me and the rest of the language team to make #swift the hottest thing since sliced bread? New job posting is up: https://jobs.apple.com/en-us/details/200553215/swift-compiler-engineer

Sadly remote is not an option, California only.

Feel free to DM me with questions.

davidbures,
@davidbures@mstdn.social avatar

Update on Cork Shortcuts support:

I have added a shortcut for refreshing packages. Next step, I'll see if I can add a separate button to Cork itself for only refreshing packages without updating them!

(also, does anyone know why Shortcuts is showing the key for each LocalizedStringResource instead of the actual string? 🤔 see pic #2 for code)

Image of code

mattiem,
@mattiem@mastodon.social avatar

@davidbures I’d try it outside of the AppIntent context to try to eliminate some variables. I’ve never used that type anywhere else.

davidbures,
@davidbures@mstdn.social avatar

@mattiem Using it outside the intent works fine 😅 I'll give it a day or two, maybe it will start working on its own

finestructure,
@finestructure@mastodon.social avatar

“With the increased limit of the acceptance queue, and a patched version of wrk, we can now conclude that swift is a good competitor speed-wise as a web application server.

Memory wise it blows all the other technologies away, using only 2.5% of the amount of memory that the java implementation needs, and 10% of node-js.”

https://tech.phlux.us/Juice-Sucking-Servers-Part-Trois/

opticalaberration,
@opticalaberration@mastodon.scot avatar

@finestructure always seemed to me to be a weird benchmark where the endpoint has a heavy CPU load. Not very typical of a standard server. Some interesting discussion though. Not sure the decision to accept more connections when server is overloaded is very clever though.

finestructure,
@finestructure@mastodon.social avatar

@opticalaberration Yeah, the Swift forums thread goes into that in detail and was very interesting.

davidbures,
@davidbures@mstdn.social avatar

I'm not promising anything for the next version of Cork just yet, but I'm trying to cook here…

davidbures,
@davidbures@mstdn.social avatar

Oh yeah it's all coming together now

#swift #macdev #CorkApp

kiwix, French
@kiwix@mastodon.social avatar

A talented developer to implement the (WiFi) HTTP Server for Kiwix iOS/macOS? All the HTTP daemon part exists already and the feature already exists on , and so this can be taken as example for the UI. https://github.com/kiwix/kiwix-apple/issues/170

JTostitos,
@JTostitos@techhub.social avatar

Swift/SwiftUI Question: App Store Connect API provides a gzip when the response is successful for a particular endpoint I am accessing.

How do I take this gzip and save the contents of it to a files app / sandbox directory / swift data, so that I can read it and view the contents? From what I understand, gzip is similar to a zip file?

So far my attempts to save it to files to read the contents have failed. It says “Inappropriate file type or format”.

mattiem,
@mattiem@mastodon.social avatar

@JTostitos You would definitely uncompress it. But after that, it is whatever type it is. If the data actually is CSV then yes.

JTostitos,
@JTostitos@techhub.social avatar

@mattiem Awesome thanks! It worked.

davidbures,
@davidbures@mstdn.social avatar

How would you go about implementing a popup search menu like this? :think_bread:

Suppose I have a NSSearchField and want to make such popup menu to let the user choose some details about their search - for example, if they want to search by a package's name or description.

Or would there be a more appropriate, and completely different, solution? What do you think?

Bryan,
@Bryan@macaw.social avatar
davidbures,
@davidbures@mstdn.social avatar

@Bryan The main problem is showing that menu with the options. I'm not sure how to do that in SwiftUI, but there might be a way in AppKit that I'm not aware of since I'm using NSSearchField

CorkApp,
@CorkApp@mstdn.social avatar
QuietMisdreavus,
@QuietMisdreavus@squad.town avatar

okay so i'm legit proud of this work

so i've been working on combining overloaded methods into a single “overload group" in curation and navigation. the work is currently landed on main and release/6.0, but right now it will just list all the overloaded symbol declarations on the page without showing you what's actually distinct between them

until now https://github.com/apple/swift-docc/pull/928

symbol documentation page for

pixel,
@pixel@social.pixels.pizza avatar
davidbures,
@davidbures@mstdn.social avatar

It will be my birthday soon on June 1st, and to celebrate, I’ll be offering a super special discount on Cork! 🎉

Starting on June 1st until June 8th, Cork will be discounted 60 percent! Yes, SIXTY, the largest discount ever.

I’ll be sharing the discount code later, so be sure to keep an eye on my profile or @CorkApp (or even follow me if you want to, I’d really appreciate that!)

#swift #swiftui #BuildInPublic #homebrew #CorkApp #apps #indieappsales #macos

image/png
image/png
image/png

dhanish,
@dhanish@mastodon.social avatar

From 2 days I've been trying to animate icons in a small utility app I made with MenuBarExtra. I can’t seem to figure out how Paste app did this animation, that goes off every time the user copies something. Anyone? Any idea?

video/mp4

davidbures,
@davidbures@mstdn.social avatar

I'm looking for some volunteers to test a new Cork version. There's one huge bug that needed to be fixed before the next version is released. Are you up for it?

I'm specifically looking for people with a lot of installed Homebrew packages.

jonathantrott,
@jonathantrott@mastodon.au avatar

@davidbures Seems to be working ok?

davidbures,
@davidbures@mstdn.social avatar

@jonathantrott Amazing, thanks a lot for testing it 👏

natpanferova,
@natpanferova@mastodon.cloud avatar

I was invited to Vincent Pradeille's YouTube channel to share some advanced Swift tips and insights from my new book "Swift Gems" 📘✨ The video is now live, check it out: https://www.youtube.com/watch?v=557nJYhPb7Y

davidbures,
@davidbures@mstdn.social avatar

Swift experts, I'm in need of assistance again

I have this code: https://gist.github.com/buresdv/aa1fa04f8d0c6bcd42cef1a361d7e0a1

It checks if a specified URL is a symlink, which works fine. But I'm having problems actually resolving the symlink using resolvingSymlinksInPath()

In the testing part at the bottom, I'm getting this:
Resolved symlink result: file:///Users/david/Developer/Testing/folderThatIsSymlink | expected /Users/david/Developer/Testing/folderThatIsSymlinkTarget

Why is the resolved symlink wrong?

#swift

cocoaphony,
@cocoaphony@mastodon.social avatar

@davidbures I can't reproduce this. Posted some comments. How did you setup the directories and links?

davidbures,
@davidbures@mstdn.social avatar

@cocoaphony You're right, it was an error in the way I set up the links :nkoFacepalm2: It works as expected now, thank you 🙃

ctietze,
@ctietze@mastodon.social avatar

Are there any API design best practices about error handling?

So far, I sketched everything with Result<Value,Error> so I get typed errors.

But both stack unwinding and the lack of ceremony of throws is appealing, too. API consumers probably don't need fine grained detail which of the 20 error cases occurred.

mattiem,
@mattiem@mastodon.social avatar

@ctietze I think in practice, there are very few reasons why callers should care about error types. The binary worked/failed is so applicable to so many situations, and I think you have to have a very compelling reason to not use it.

icanzilb,
@icanzilb@mastodon.social avatar

@ctietze yes, I get it - type checking this way is handy 👍🏼

mstankiewicz, Polish
@mstankiewicz@pol.social avatar
parpok,
@parpok@101010.pl avatar
parpok,
@parpok@101010.pl avatar

@mstankiewicz dodać jeszcze legendarne Suzuki Swift

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