> Markdown version of [/videos/707-create-dsl-domain-specific-language-on-top-of-swift?t=3](https://www.wearedevelopers.com/videos/707-create-dsl-domain-specific-language-on-top-of-swift?t=3). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Create DSL (Domain Specific Language) on top of Swift Why build a custom compiler from scratch when you can leverage Swift? Discover how native result builders let you craft elegant, declarative DSLs for complex business logic. - **Speakers:** Milan Todorović - **Event:** World Congress 2023 - **Published:** September 27, 2023 - **Duration:** 27:18 - **URL:** https://www.wearedevelopers.com/videos/707-create-dsl-domain-specific-language-on-top-of-swift ## Summary Creating Domain-Specific Languages (DSLs) solves complex business problems by establishing a customized developer vocabulary of nouns, verbs, and attributes optimized for specific problem spaces. While generative AI tools are actively discussed, writing an internal DSL ensures precise technical reliability and rapid execution within a heavily defined domain setting. By leveraging Swift as a host language, developers can bypass building custom compilers from scratch while taking advantage of its highly readable, declarative syntax. Swift enables this architecture natively through critical language features like property wrappers, trailing closures, and modifier-style methods that allow for clean API chaining and functional object modification. Crucially, Swift 5.4 introduced result builders, which serve as the backbone for combining coding expressions declaratively—a pattern famously utilized by Apple's own SwiftUI framework. During a practical technical demonstration, standard array-based UI configurations seamlessly transform into an elegant, declarative drawing builder using protocol-driven structs. A profound architectural insight discussed is that internal DSLs natively inherit standard host capacities, allowing engineers to deploy standard flow control, like conditional loops, directly inside custom blocks. Furthermore, adopting an existing host language allows teams to rely on out-of-the-box ecosystem tooling; developers automatically reap the benefits of features like drag-and-drop IDE components and Xcode live previews without needing to reinvent native environments. Ultimately, embracing internal DSL building principles empowers software teams to standardize abstract logic rapidly while cleanly retaining the full underlying power of their general-purpose codebases. **Keywords:** domain-specific dsl architecture, internal dsl swift, swift declarative syntax, result builders implementation, swiftui framework adoption, property wrappers configuration, trailing closures functionality, modifier-style methods chaining, host language flow control, xcode preview integration, functional programming builders, general-purpose languages gpl ## Chapters 1. **Understanding domain specific languages in software development** (00:03) — A domain specific language operates at a high level of abstraction to optimize solutions for highly targeted problem spaces. 1. **Classifying domain specific languages as external or internal** (02:06) — Developers can create new syntax from scratch or utilize an existing host language to build internal solutions. 1. **Choosing domain specific languages over artificial intelligence models** (03:28) — While large language models generate answers probabilistically, domain languages provide absolute reliability and focused execution for complex systems. 1. **Applying best practices to create intuitive custom languages** (04:55) — Mimicking natural English patterns in code syntax creates closer alignment and easier collaboration between developers and domain experts. 1. **Identifying common domain specific languages in everyday development** (06:06) — Many widely adopted technologies like template markups, shell scripts, and query systems operate entirely as specialized domain tools. 1. **Analyzing SwiftUI as an internal domain specific language** (07:19) — Apple's user interface framework translates structural elements and visual modifiers into equivalent standard nouns and verbs within code blocks. 1. **Exploring core Swift syntax features that enable language creation** (11:45) — Advanced capabilities like property wrappers and trailing closures provide the foundational architecture necessary to construct expressive syntactic tools. 1. **Implementing foundational result builders and drawing protocols in Xcode** (15:54) — Structuring custom types and commands within result builders forms the underlying logic for a personalized drawing language application. 1. **Executing custom drawing language syntax alongside native Swift loops** (19:36) — Embedding native flow controls organically into constructed block elements renders processed outputs cleanly inside standard execution environments. 1. **Answering audience questions regarding version control and interface tracking** (24:21) — Relying on the host ecosystem allows custom languages to inherit mature native tooling packages without overhead engineering. ## Related Moments - [Enhancing developer experience with SDK discovery and DSLs](https://www.wearedevelopers.com/videos/128-building-a-friendly-kotlin-sdk-to-connect-to-jetbrains-space) (from "Building a Friendly Kotlin SDK to Connect to JetBrains Space") - [Introduction to domain specific languages and their applications](https://www.wearedevelopers.com/videos/762-langium-design-your-own-language-in-node-js-and-vs-code) (from "Langium: Design your own language in Node.js and VS Code") - [Business drivers for designing domain specific languages](https://www.wearedevelopers.com/videos/437-langium-design-your-own-language-in-node-js-and-vs-code) (from "Langium: Design Your Own Language in Node.js and VS Code") - [Introduction to programming language internal workings](https://www.wearedevelopers.com/videos/692-making-sense-of-programming-languages) (from "Making Sense of Programming Languages") - [Implementing language model sessions using Swift asynchronous coding](https://www.wearedevelopers.com/videos/1515-harnessing-apple-intelligence-live-coding-with-swift-for-ios) (from "Harnessing Apple Intelligence: Live Coding with Swift for iOS") - [Reviewing Xcode implementations and Vision framework documentation reference resources](https://www.wearedevelopers.com/videos/167-let-your-ios-app-read-texts) (from "Let your iOS app read texts") ## Related Articles - [Dev Digest 132 - Binging WADFlix?](https://www.wearedevelopers.com/magazine/473-dev-digest-132-binging-wadflix) - [Declarative Design and a fresh take on collaboration with developers](https://www.wearedevelopers.com/magazine/595-declarative-design-and-a-fresh-take-on-collaboration-with-developers) - [Dev Digest 130 - The Diablo is in the details](https://www.wearedevelopers.com/magazine/470-dev-digest-130-the-diablo-is-in-the-details) - [How to Avoid Over-Engineering](https://www.wearedevelopers.com/magazine/546-how-to-avoid-over-engineering) ## Related Jobs - [iOS Engineer, Swift/SwiftUI/Combine (B2C Broker)](https://www.wearedevelopers.com/jobs/ext/1611832-ios-engineer-swift-swiftui-combine-b2c-broker) at **Bitpanda** - [Principal Software Engineer](https://www.wearedevelopers.com/jobs/ext/267587-principal-software-engineer) at **Twilio** - [Senior Software Engineer (L3)](https://www.wearedevelopers.com/jobs/ext/1956800-senior-software-engineer-l3) at **Twilio** - [Principal Software Engineer](https://www.wearedevelopers.com/jobs/ext/267591-principal-software-engineer) at **Twilio** - [Software Engineer, Identity](https://www.wearedevelopers.com/jobs/ext/1713561-software-engineer-identity) at **Twilio** - [Principal Software Engineer](https://www.wearedevelopers.com/jobs/ext/115163-principal-software-engineer) at **Twilio**