RSSAmplifier

Blog

enekoalonso.com

This is the personal site of Eneko Alonso, a software engineer in California. All content included and opinions expressed on this site are personal and do not represent any of his current or past employers.

enekoalonso.comRSS feed ↗20 posts

Latest posts

First time using Xcode Cloud

Here I am, finally got access to Xcode Cloud, so let’s give it a shot and see how it works. I’ll be writing this post as I go, and learn how to use it. More than words, this is probably going to be a bunch of screenshots, will see 😄 The email Here is a screenshot from the email I got yesterday from Apple: Let’s go First of all, I went to App Store Connect to see what was on the Xcode Cloud tab…

Displaying images in SwiftUI views from Swift Package resources

Long title for something that should be simple, but actually kind of hard to search online. Scenario/prerequisites: A Swift Package (library/command line) for iOS or macOS An image file (png or jpeg) SwiftUI :) Step 1: Add resources to the Swift package If your package doesn’t have any resources yet, follow these steps: Create a Resources folder inside your library code (eg.…

Writing AWS SQS producers and consumers in Swift (Demo)

I published on GitHub an example of an AWS SQS producer and consumer application written in Swift . This demo is pretty simple, but illustrates how to send messages to SQS and how to poll for messages. ┌──────────────────┐ ┌──────────────────────┐ ┌──────────────────┐ │ │ │ AWS │ │ │ │ Producer │───────▶│ Simple Queue Service │───────▶│ Consumer │ │ │ │ │ │ │ └──────────────────┘…

Distributing and Consuming SwiftUI views with Swift Package Manager

It is possible to embed SwiftUI views in Swift packages with Swift Package Manager, so they can be distributed, online or internally in your organization, and used across multiple applications. Benefits Moving SwiftUI views to libraries has many benefits: Improved modularization Reduced dependencies Improved reusability Improved replaceability Improved collaboration Improved Modularization…

Creating iOS Application Icons with SwiftUI

SwiftUI was introduced to the world at WWDC in June 2019. While the main goal for SwiftUI is to build rich user interfaces on iOS and other Apple platforms, it can also be used to do other fun things. I couldn’t resist using SwiftUI from the command line, and I wrote about it in Rasterizing SwiftUI views from the command line to showcase how to generate static images (PNG, JPEG, etc). I published…

Dealing with camelCase, snake_case, PascalCase, kebab-case and other custom JSON property names in Swift

Swift’s Codable protocol (together with Encodable and Decodable ) was introduced in Xcode 9 with Swift 4. This changed for good how we encode and decode JSON. In this article I’m hoping to show you how to make this experience better, when dealing with JSON keys in other formats. Encoding/Decoding JSON with camelCase keys If we are lucky, the JSON we work with will follow Swift naming conventions.…

Using regular expressions in Xcode to search and replace text

I had to convert a long list of error codes from C# to a Swift enum, and thought this would be a great opportunity to use regular expressions. Error codes looked like this example: ConsumerSchedulingInfoNotFound = 304, I’m using an enum with String rawValue, so it can be easily initialized from JSON. The same error code in the enum would look like this: case consumerSchedulingInfoNotFound =…

Using GitHub label colors for social media image background

After I started using GitHub Actions to generate social media preview images for my blog, I wanted to use them on my home page. This part was easy, but wasn’t too fond on the result: too many blue rectangles 😅 I figured I could use the color from GitHub labels associated to the blog article, to set different background colors for the images. Since articles can have multiple tags, I made a list of…

Preventing GitHub workflows from running when the issue is still open

I’ve been working on some updates for my Blog Engine here and there. One of the updates was to prevent the publishing workflow from being triggered while working on an article. Before I was using a label Draft, and manually checking for it in my Swift code. But at that point, the only way to stop the workflow would be to make it fail. Instead, using action if conditions , I can check for the issue…

Twelve Days of Christmas

I didn’t want to end the year without completing this challenge from Scott Smith (@scottsmithdev) . The challenge consists on printing out the lyrics of the song Twelve Days of Christmas without repeating any of the lyrics lines in code. The Lyrics I found the lyrics on the internet , might not be exact punctuation, casing, etc. 🎄🎶 The Twelve Days Of Christmas 🎶🎄 On the 1st day of Christmas My…

The power of plain text

I’m sitting in the couch te-reading The Pragmatic Programmer, and couldn’t but share this quote. …we believe that the best format for storing knowledge persistently is plain text . With plain text, we give ourselves the ability to manipulate knowledge, both manually and programmatically, using virtually every tool at our disposal. The problem with most binary formats is that the context necessary…

Making beautiful architecture diagrams with Keynote

I started working on an updated architecture diagram to illustrate the current state of my Blog Engine, and decided to write about the tools I use. Why Keynote? I am a big fan of Dot , a text-based language for making undirected and directed graphs using only text. Among other things, I’ve used Dot for generating Swift Package documentation with SourceDocs , or this diagram of Bobiverse (first…

Generating Social Media preview images with SwiftUI and GitHub Actions

Social Media previews look pretty neat when sharing links to your blog on social media (e.g. Twitter). These can be configured in many ways, and are often defined manually (unique image per post). Some sites use a heading image for the blog post that appears at the top of the article and in social media. Manually picked preview images Here is an example of a shared post from my blog, where the…

Testing Linux Swift packages from macOS terminal with Docker

For those of us that write Swift Packages that run on Linux, testing them on that platform before deployment can be a good time saver. Specially when dealing with code that is available on macOS but not on Linux (e.g. Foundation vs FoundationNetworking ). Using Docker for testing Swift Packages on Linux from the command line is not a new technique. There are many articles describing how to do…

My 2020 year in review

Here are some of the things I did in the tech-sphere on 2020. Articles Solve sudoku puzzles programmatically without using brute force . It was a pretty fun project to do, as I like doing programming challenges every now and then and this was one that I had pending for a while. Documenting Swift Packages with SourceDocs . See SourceDocs 1.0.0 for details on new features added. Using DateTemplates…

How to quickly type Apple keyboard symbols (⇪⇧⌃⌥⌘) on macOS & iOS

There might be better ways to do it, but here is my trick: using system shortcuts. Here are some of the shortcuts I have, which can be used in most apps on macOS and iOS, thanks to iCloud syncing. And the table of symbols, for easy copy-pasting: Caps Lock: ⇪ Shift: ⇧ Control (CTRL): ⌃ Option (OPT): ⌥ Command (CMD): ⌘ Hope you found this helpful! This article was written as an issue on my Blog…

It works! My over-engineered blog engine is (a)live!

If you’ve been following my recent tweets or issues on this my Blog repository, you might be aware that a couple of days ago, I started working on this idea of using GitHub Issues for creating post entries for my GitHub Pages Jekyll site . I’ve started working on a new event driven, server-less blogging engine for my GitHub Pages blog. 100% over-engineered, just for fun. — Eneko Alonso…

Notes from my AWS training

A couple of weeks ago, on December 8-10, I took a three day class for AWS training. Really intensive, but definitely worth it. The week after, I got the AWS Developer Associate certificate 🎉 I took some notes during training that I don’t want to lose, so I decided to write them on a post, for future review and in hopes that they can help someone else. Please beware these notes are pretty scarce…

Blog Engine - Triggering a GitHub Actions workflow via REST API

So, as the title says, here is my plan for getting my GitHub Pages site updated: trigger a workflow from Lambda, and have the workflow pull the new updates (either from a remote repo in CodeCommit, an S3 bucket, or maybe an API Gateway). For this last part, I’ll probably use GitHub Push , or a similar action, to commit and push the changes to the GitHub Pages repo. Manually triggering a GitHub…

Blog Engine - Sending entire GitHub Actions contexts to SQS

Rather than digging through the github context in YAML, I decided to use toJSON() to encode the entire context and send it to Amazon SQS. message : ${ { toJSON(github) }} Still not sure if that will provide enough information to identify the Activity Type being performed in the issue. Update It’s been a busy day, but now I’m back at it. After testing this new flow, sending the entire JSON payload…