Swift

igorcamilo,
@igorcamilo@mastodon.social avatar

Hi Fediverse 👋 I would really appreciate boosts or recommendations.

Unfortunately I was affected by the latest layoff at my (now former) company and started looking for a new job.

I have 10 years experience in iOS development (Swift, Objecive-C, UIKit, SwiftUI) and some experience in web (JavaScript, TypeScript, Java, PHP).

Currently looking remote or on-site in Berlin.

Thank you

freemo,
@freemo@qoto.org avatar

@igorcamilo We are hiring 100% remote positions that are mostly java focused (but expecting polyglots).. not sure youll be a great fit (no iOS) but I saw "Java" and thought id let you know. Im the owner and hiring manager. Here are the positions we have:

https://docs.cleverthis.com/en/human_resources/organizational_structure/sr_developer

krzyzanowskim,
@krzyzanowskim@mastodon.social avatar

If you asked how @SwiftStudio going. Well... it been better. Apple just recently decided to shutdown API I use (to make things CLI cannot provide). I find it unexpected (to me, not to apple) move after many years. https://github.com/apple/swift-package-manager/issues/7440

I'm disappointed with a move in that direction and find that decision harmful for the third-party dev tooling ecosystem trying to adopt SwiftPM. IMHO.

helge,
@helge@mastodon.social avatar

@heckj @nickmain I wrote a wrapper for Wasmer a while ago, not sure it still works, but might be worth a look if you want to go that route: http://www.alwaysrightinstitute.com/swifty-wasmer/

dgregor79,
@dgregor79@sfba.social avatar

@helge @nickmain @heckj if you’re looking to embed a Wasm interpreter, there’s also WasmKit: https://github.com/swiftwasm/WasmKit

airspeedswift,
@airspeedswift@mastodon.social avatar

More embedded goodness on the blog

https://www.swift.org/blog/embedded-swift-examples/

pepicrft,
@pepicrft@mastodon.social avatar

We are going to draw inspiration for the @vuejs ecosystem to design @tuist ’s
approach to open source. We’ll extract reusable functionality into independent layers as Swift Packages for anyone to use, and come up with new layers to underpin some future Tuist Cloud ideas.

Besides XcodeProj, which we open sourced a long time ago, we’ll extract Tuist’s generation logic into an XcodeProjectGenerator package, and we are also working on SwiftTerminal, a set of tools to build better CLIs in

pepicrft,
@pepicrft@mastodon.social avatar
ctietze,
@ctietze@mastodon.social avatar

@pepicrft Yes that's cool :)

rhonabwy.com,

This weekend I was frustrated with my debugging, and just not up to digging in and carefully, meticulously analyzing what was happening. So … I took a left turn (at Alburquerque) and decided to explore an older idea to see if it was interesting and/or useful. My challenging debugging was all about network code, for a collaborative, peer to peer sharing thing; more about that effort some other time.

A bit of back story

A number of years ago when I was working with a solar energy manufacturer, I was living and breathing events, APIs, and running very distributed, sometimes over crap network connections, systems. One of the experiments I did (that worked out extremely well) was to enable distributed tracing across the all the software components, collecting and analyzing traces to support integration testing. Distributed tracing, and the now-popular CNCF OpenTelemetry project weren’t a big thing, but they were around – kind of getting started. The folks (Yuri Shkuro, at least) at Uber had released Jaeger, an open-source trace collector with web-based visualization, which was enough to get started. I wrote about that work back in 2019 (that post still gets some recurring traffic from search engines, although it’s pretty dated now and not entirely useful).

We spun up our services, enabled tracing, and ran integration tests on the whole system. After which, we had the traces available for visual review. It was useful enough that we ended up evolving it so that a single developer could stand up most of their pieces locally (with a sufficiently beefy machine), and capture and view the traces locally. That provided a great feedback loop as they could see performance and flows in the system while they were developing fixes, updates and features. I wanted to see, this time with an iOS/macOS focused library, how far I could get trying to replicate that idea (time boxed to the weekend).

The Experiment!

I’ve been loosely following the server-side swift distributed tracing efforts since it started, and it looked pretty clear that I could use it directly. Moritz Lang publishes swift-otel, which is a Swift native, concurrency supported library. With his examples, it was super quick to hack into my test setup. The library is set up to run with service-lifecycle pieces over SwiftNIO, so there’s a pile of dependencies that come in with it. To add to my library, I’d be a little hesitant, but an integration test thing, I’m totally good with that. There were some quirks to using it with XCTest, most of which I hacked around by shoving the tracer setup into a global actor and exposing an idempotent bootstrap call. With that in place, I added explicit traces into my tests, and then started adding more and more, including into my library, and could see the results in a locally running instance of Jaeger (running Jaeger using Docker).

Some Results

The following image is an overview of the traces generated by a single test (testCreate):

https://josephheck.files.wordpress.com/2024/04/trace_overview.pngThe code I’m working with is all pushing events over web sockets, so inside of the individual spans (which are async closures in my test) I’ve dropped in some span events, one of which is shown in detail below:

https://josephheck.files.wordpress.com/2024/04/trace_with_detail.pngIn a lot of respects, this is akin to dropping in os_signposts that you might view in Instruments, but it’s external to Xcode infrastructure. Don’t get me wrong, I love Instruments and what it does – it’s been amazing and really the gold standard in tooling for me for years – but I was curious how far this approach would get me.

Choices and Challenges

Using something like this in production – with live-running iOS or macOS apps – would be another great end-to-end scenario. More so if the infrastructure your app was working from also used tracing. There’s a separate tracing project at CNCF – OpenTelemetry Swift – that looks oriented towards doing just that. I seriously considered using it, but I didn’t see a way to use that package to instrument my library and not bring in the whole pile of dependencies. With the swift-distributed-tracing library, it’s an easy (and small) dependency add – and you only need to take the hit of the extra dependencies when you want to use the tracing.

And I’ll just “casually” mention that if you pair this with server-side swift efforts, the Hummingbird project has support for distributed tracing currently built in. I expect Vapor support isn’t too far off, and it’s a continued focus to add more distributed tracing support for a number of prevalent server-side swift libraries over this coming summer.

See for Yourself (under construction/YMMV/etc)

I’ve tossed up my hack-job of a wrapper for tracing during testing with iOS and macOS – DistributedTracer, if you want to experiment with this kind of thing yourself. Feel free to use it, although if you’re amazed with the results – ALL credit should go to Moritz, the contributors to his package and the contributors to swift-distributed-tracing, since they did the heavy lifting. The swift-otel library itself is undergoing some major API surface changes – so if you go looking, I worked from the current main branch rather than the latest release. Moritz shared with me that while the API was not completely solid yet, this is more of the pattern he wants to expose for an upcoming 1.0 release.

Onward from here

I might push the DistributedTracer package further in the future. I think there’s real potential there, but it is not without pitfalls. Some of the challenges stem from constantly exporting data from an iOS app, so there’s a privacy (and privacy manifest) bit that needs to be seriously considered. There are also challenges with collecting enough data (but not too much), related choices in sampling so that it aligns with traces generated from infrastructure, as well as how to reliably transfer it from device to an endpoint. Nothing that can’t be overcome, but it’s not a small amount of work either.

Weekend hacking complete, I’m calling this a successful experiment. Okay, now back to actually debugging my library…

https://rhonabwy.com/2024/04/02/distributed-tracing-with-testing-on-ios-and-macos/

image/png

i2h3,
@i2h3@toot.community avatar

Ah… 💡 async functions always run on the cooperative thread pool unless they are actor isolated. That explains one or two things. 😄

https://swiftwithmajid.com/2024/03/20/where-swift-concurrency-will-run-your-function/

yoyokuo,

Should I keep the iCloud Sync toggle for user or not🧐

luckkerr,
@luckkerr@mastodon.world avatar

@yoyokuo There is always a system setting for that which can be disabled per app. Users can go there if they really want to disable sync.

dale_price,
@dale_price@mastodon.online avatar

What's the proper way of handling Required Reason APIs when the API in question is only referenced by a part of a package dependency that I'm not ever calling?

None of the usage reasons fit – there's no way to declare “this is only linked because a dependency references it, but I pinky promise my app doesn’t actually call it”

humblehacker,

@dale_price I'd work with the package maintainer to make that part of the package optional. In the short term, I'd consider forking, removing the problematic code, and using my fork until the changes can be upstreamed.

davidbures,
@davidbures@mstdn.social avatar

The next version of Cork fixes seemingly all memory leaks.

I have no idea how I accomplished that, but Instruments says there are no leaks anymore, so I'll take it as a win lmao

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

nemesisprime,
@nemesisprime@iosdev.space avatar

@davidbures that’s such a good feeling 🙂

davidbures,
@davidbures@mstdn.social avatar

@nemesisprime It is indeed. I wish I knew how to use Instruments 😂

Svyrydov,

news - if you have MacBook Air for new Xcode you will need to update to Pro versions.

Jeehut,
@Jeehut@iosdev.space avatar

tip of the day: 💡

You want to store just the day part of a Date? Use "GregorianDay" with ! It's Codable & all. 💯

There's also "GregorianTimeOfDay" for just the time! 🕓

Read the full article for more handy types like these: 👇
https://swiftpackageindex.com/flinedev/handyswift/main/documentation/handyswift/new-types

TeddRod, French

Today begins a long journey towards learning . For the beginning of my journey, after reading a few articles at @twostraws, I chose to create a REST API with the @codevapor framework.

Wish me good luck 🫡 🇫🇷

davidbures,
@davidbures@mstdn.social avatar

@TeddRod @twostraws @codevapor I wish you the best of luck! Don't hesitate to as questions here, the community is very supportive.

Starting out with Vapor is quite the challenge.

TeddRod,

@davidbures It’s good to hear, let’s go 💪!

finestructure,
@finestructure@mastodon.social avatar

This silly idea led me to check the total number of stars across all repositories tracked by the @SwiftPackageIndex and that number is

2,267,378 stars

I'd say $2.3M/month is a bargain for the combined value of Open Source packages. But "free" is an even bigger bargain I guess 🫠

https://mastodon.social/@finestructure/112184650286105137

mattiem,
@mattiem@mastodon.social avatar

@finestructure Riiiight, I guess this might be accessible via some GitHub API / FUNDING.yml parsing but quite non-trivial. Oh well!

finestructure,
@finestructure@mastodon.social avatar

@mattiem Yes, that’s what we’re ingesting to display the sponsorship box above the compatibility matrix:

https://swiftpackageindex.com/SwiftPackageIndex/SwiftPackageIndex-Server

ktoso,
@ktoso@mastodon.social avatar

Want to participate in project's google summer of code ?

Don't miss the deadline! Proposals must be sent in before April 2nd, over here: https://summerofcode.withgoogle.com

https://www.swift.org/blog/swift-google-summer-of-code-2024/

younata,
@younata@hachyderm.io avatar

Announcing swift-fakes, the beginning of standardized test doubles for Swift!

Swift Fakes aims to provide standardized implementations of common test doubles, massively improving the readability and reliability of your tests. Currently, Swift Fakes provides the Spy class, for recording calls and returning stubbed responses. But I'm aiming to expand its offerings quickly.

Please check it out! https://github.com/Quick/swift-fakes

ktoso,
@ktoso@mastodon.social avatar

We're happy to share the the annual Server Workgroup goals update: https://www.swift.org/blog/sswg-update-2024/

As well as the report of the 2023 Server Swift Survey: https://forums.swift.org/t/report-server-side-swift-developer-survey-2023/70966

image/png

brandonhorst,
@brandonhorst@techhub.social avatar

I’m having a hell of a time with AVAudioSession, trying to get both AVSpeechSynthesizer and AVAudioRecorder working in the same app (not at the same time). Anybody done something like this?

NameItGames,

@brandonhorst We usually find it’s best to stick with .playAndRecord and avoid switching between categories else the number of possible audio lifecycle states really blows up. Are you getting the recorder and synth working but not as desired, or not working at all?

brandonhorst,
@brandonhorst@techhub.social avatar

@NameItGames Thanks! I think I got something working, by keeping .playAndRecord enabled all the time (like you said) and also setting usesApplicationAudioSession = false on the AVSpeechSynthesizer. I haven’t tested all the edge cases yet, but at least nothing just stops working as far as I can tell.

davidbures,
@davidbures@mstdn.social avatar

I will pay 100€ to whoever fixes this issue: https://github.com/buresdv/Cork/issues/191

davidbures,
@davidbures@mstdn.social avatar

@mattorantimatt Thanks a lot! :)

mattorantimatt,

@davidbures Feedback FB13699166

davidbures,
@davidbures@mstdn.social avatar

I have a question for the Swift gods:

On my journey to convert SwiftyJSON in Cork to Codable, I ran into a slight problem. Some of the JSON I’m parsing has this format:
[{formula: { // the data that I actually need}}, cask: { // empty and I don’t care}]

Is there a way to access the data inside “formula”, without having to define Formula as a useless struct? Using SwiftyJSON for this made the code really nice, since I could directly access the data in there.

deanatoire,
@deanatoire@mastodon.social avatar

@davidbures This is what I can suggest for your current structures

davidbures,
@davidbures@mstdn.social avatar

@deanatoire That’s very smart! Thanks a lot 👏

ctietze,
@ctietze@mastodon.social avatar

frens, I'm researching how to find out the proper Bundle in 2024 and if anything changed but the best I have in my notes is this:

let bundle: Bundle = {
#​if SWIFT_PACKAGE
return Bundle.module
#​else
return Bundle.main
#​endif
}()

and my web searches weirdly suggest trying multiple fallbacks etc. which confuses me :)

How do you reference a Swift Package's Bundle nowadays to access its bundled resources?

ctietze,
@ctietze@mastodon.social avatar

@mattiem This works:
An XCTest target
of the app
that uses the package
that uses the bundle detection code
to get to its resources.

swift test on the package also works and the font can be loaded.

ctietze,
@ctietze@mastodon.social avatar

Thanks for the feedback and tips @mattiem @uliwitness @MyLittleMetroid

I tested with iOS, macOS, SwiftUI, XCTest, and command line builds. Worked so far™️

https://christiantietze.de/posts/2024/03/ship-custom-fonts-within-a-swift-package/

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

Updates to Cork:

Even though it might not be required since Cork is not on the App Store, I still added the new AppPrivacy stuff to it in this commit: https://github.com/buresdv/Cork/commit/ca9c3746edeaee2e456593c3786d3d006b7bbabb

So you can be sure that there's no privacy shenanigans going on :cat_1:

puppethead,
@puppethead@ieji.de avatar

@davidbures @melgu @codedbydan That looks like what I ran into with the "id" property expected to be in the JSON data. I got around that by making my "id" property a computed property. JSONDecoder/JSONEncoder ignore those. I don't know if that would work for you in this case.

davidbures,
@davidbures@mstdn.social avatar

@puppethead @melgu @codedbydan Interesting idea, but it unfortunately doesn't work in my case. Making it a computed property makes my navigation stop working.

At times like this, I wish there was something like a @noncodable property wrapper that would allow you to exclude a property from the encoding/decoding process, instead of having to duplicate everything in CodingKeys :x

david_swift,

Check out the latest blog post on the #swiftlang website about the #adwaita for #swift package!

https://www.swift.org/blog/adwaita-swift/

You can find the repo on GitHub: https://github.com/AparokshaUI/adwaita-swift

#linux #libadwaita #gnome #gtk

finestructure,
@finestructure@mastodon.social avatar

swift.org is on FIRE 🔥 recently! Another great post about in unusual places 👌

https://www.swift.org/blog/adwaita-swift

phranck,
@phranck@chaos.social avatar

@finestructure This is a real bummer! I’m totally impressed, 👌

RA_Negm,
@RA_Negm@mastodon.social avatar

@finestructure "Swift is well-suited for creating user interfaces thanks to the clean syntax, static typing, "

And I closed the tab.

QuietMisdreavus,
@QuietMisdreavus@squad.town avatar

huh, this is really cool: there's a GNOME library for Swift that provides a declarative SwiftUI-style method for writing the UI views https://www.swift.org/blog/adwaita-swift/

in fact, the simple examples they used look almost exactly like SwiftUI, lol

icanzilb,
@icanzilb@mastodon.social avatar

@QuietMisdreavus looks pretty good to me 👌🏼

ktoso,
@ktoso@mastodon.social avatar

Third day! Swift contribution workshop! Best of luck everyone and feel free to reach out to me for help 🙏

頑張ってください。助けが必要なら遠慮なく私に連絡してください!

image/png

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