<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Swift on Feel the magic of kool.</title><link>https://vladde.net/tags/swift/</link><description>Recent content in Swift on Feel the magic of kool.</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 12 Oct 2026 01:15:58 +0200</lastBuildDate><atom:link href="https://vladde.net/tags/swift/index.xml" rel="self" type="application/rss+xml"/><item><title>Using Swift macros for better DX</title><link>https://vladde.net/blog/swift-macros-for-ourselves/</link><pubDate>Mon, 12 May 2025 00:00:00 +0200</pubDate><guid>https://vladde.net/blog/swift-macros-for-ourselves/</guid><description>&lt;p>When migrating our app to become Swift 6 compatible, I took the opportunity to take a look into Swift macros, since our storage helper had a lot of duplicate boilerplate code.&lt;/p>
&lt;h2 id="using-macros">Using macros&lt;/h2>
&lt;p>Mapping API data models to Core Data models included a lot of (almost) duplicate code for every method: calling code in the correct context, fetching existing (or creating new) models, saving context, etc.&lt;/p>
&lt;p>I created a macro which smooths out this process, while still being type-safe. This is what a mapping method looks like:&lt;/p></description></item></channel></rss>