Welcome

The beautify of Swift Language — Property Observer

Property is a common concept in object-oriented programming languages. It is a member of an object and usually accessed using dot syntax. Sometimes, it can be very useful to observe the property value changes. For example, observing the balance property of a BankAccount object and logging out all the changes of the balance property could be very helpful to audit if all the transactions are recorded correctly in the BankAccount . Let’s take a look how this can be done in the following languages.

The standard of good codebases

As software engineers, it’s no surprises that we often find ourselves in a conversation talking about working on a bad codebase or seldomly a good one. But what makes a good codebase exactly? I will summarise my opinion here and please comment below if you have different thoughts.

Fight against Memory Circular Reference

As iOS developers, we all know and love Automatic Reference Counting (ARC), which is one of the main reasons to keep iOS apps run smoothly. While both ARM and GC(Garbage Collection) free developers from managing memory usage manually, unlike GC, ARC release unused memory in a deterministic way so that the system does not need to hang the apps randomly to collect unused memory like GC.

Implement an AsyncSequence

We have known AsyncSequence is a great part of Swift Concurrency feature and learnt the difference between it and Combine Publishers from this article. We’re going to look into ways of creating of an AsyncSequence in this one.

AsyncSequence vs. Combine Publisher

AsyncSequence and Combine Publisher are different ways of handling future data. Both of them have rich operators/methods like map, filter, combineLatest etc. to manage the data flow. But what are the differences and which one should we use?

My setup of Starlink intranet to make computers at home accessible on internet

In order to make a computer within home intranet publicly accessible, we need to rely on the public IP(DDNS might be needed if the public IP is not static) of the router and configure NAT to the computer.

Some Xcode Editing features that take your productivity to the next level

Introducing SwiftCodePatterns Package

Macro is a newly added feature in Swift to generate code based on some patterns. However, due to its design goal, the code can be generated using macros is limited. For example, we cannot simply generate an extension to an existing type using current macro mechanism. But some code patterns in App code are very common.

Swift Code Patterns Package offers a new way to generate code based on other code to reduce writing boilerplate code. It has potential to handle more complex patterns as well. If you have more ideas relating to this, please feel free to reach out.

My experience in developing Swift Macros

I have developed a collection of Swift Macros in this repo recently. This article will summarise my experience and hopefully it would be helpful for your tasks.

Setup to develop Swift Macros

This tutorial is a step-by-step guide to develop Swift Macros. We will develop an attached Macro called Singleton.

Macros in Swift vs. KSP in Kotlin

In essence, these two technologies are completely different. While one is generating code by expanding the macro patterns, another is generating code freely based on the meta data stored in the complied code.

Integrate code review result into Xcode

The goal of this experiment is to integrate the code review result from ChatGPT into Xcode editor view

Let ChatGPT review your code

ChatGPT has been phenomenal since day one. It demonstrated its great intelligence in areas like drawing, coding etc. This LLM is capable of understanding and providing insights of the code, which is the why I have been trying to leverage it to do code review. Here is a summary that I have got so far.

DRY - Don’t Repeat Yourself

DRY(Don’t Repeat Yourself) aims at reducing the repetition of code chunks and patterns, which was first defined in the book The Pragmatic Programmer as “every piece of knowledge must have a single, unambiguous, authoritative representation within a system.”