home.social

#swiftwithc — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #swiftwithc, aggregated by home.social.

  1. As part of a continuing work in progress, but `clipng` is a Swift/Argument Parser wrapper around a Swift wrapper for libpng that will generate a png with random(*) pixels on Ubuntu or MacOS.

    * Default system random.

    TODO: Import pixels values from the Champixel region of the CPU, for the truly bespoke pixel needs.

    #Swift #SwiftLang #SwiftWithC #CLI #ArgumentParser

    github.com/carlynorama/clipng

  2. Well I did it. I got a Swift wrapper around a homebrew install of libpng working. "Hello PNG" works for both reading and writing RGBA data

    Next step is to get jmpdef to translate to a function that throws in a more Swifty way.

    Pretty extensive README.md and META.md for those who'd want to duplicate.

    github.com/carlynorama/SwiftLI

    #SwiftLang #C #SwiftWithC #libpng

  3. Well, I am still working on that Swift based mastodon bot, but it "requires" learning about Swift and C interoperability (narrator: it really doesn't)... so I spent some time last week writing a package/sample project with test code. I have to say I <3 the Swift `Unsafe` APIs. Having a pointer only exist for a closure so you can't forget to dealloc...? so so good. And `.loadasUnaligned` is going to be so handy for data protocols.

    github.com/carlynorama/UnsafeW

    #SwiftLang
    #SwiftWithC