ios

Building a Native Encrypted DNS App for macOS with AI Coding: DNS Security Pro

How I turned my experience building an iOS product into a native SwiftUI system DNS manager with DoH and DoT support.

Building a Native Encrypted DNS App for macOS with AI Coding: DNS Security Pro

I recently used AI-assisted coding to complete a new open-source project: DNS Security Pro for macOS.

It is an independent, native macOS app built with SwiftUI, the AppKit lifecycle, and Apple’s NetworkExtension APIs. It lets users switch between DNS over HTTPS (DoH) and DNS over TLS (DoT) on their Mac. This is neither a direct port of the iOS interface nor a Mac Catalyst app. It was redesigned around the way people use macOS.

The project is based on my firsthand experience building and maintaining the iOS versions of DNS Security. AI helped me organize the requirements, implement the code, and refine the documentation, but the product decisions and technical constraints came from real development experience.

The goal is simple: make encrypted DNS easy to understand and switch while giving users enough visibility to know which DNS profile is currently active.

Why use encrypted DNS?

When you enter a website address, your device first performs a DNS lookup to translate the domain name into an IP address. Even when the website itself uses HTTPS, traditional DNS queries may still be sent without encryption, allowing other parties on the network path to observe or interfere with them.

DoH and DoT encrypt DNS queries between your device and the selected DNS resolver:

  • DNS over HTTPS sends DNS queries over HTTPS.
  • DNS over TLS protects DNS queries through a dedicated TLS connection.

DNS Security Pro changes only the system’s DNS resolution method. It does not route all network traffic through a VPN server. This also means it is not a VPN: it does not hide your IP address or automatically make your browsing anonymous. You still need to choose a DNS provider you trust.

What does DNS Security Pro for macOS offer?

A native macOS experience

This is a native app for macOS 14 and later. The Dashboard shows the current system DNS status, the selected profile, and Connect or Disconnect controls. If the system state has not finished loading or cannot be read, the app displays a loading or retry state instead of incorrectly treating an unknown state as disabled.

System-wide DoH and DoT

The app uses Apple’s NEDNSSettingsManager to write the system DNS settings. Once applied, the configuration works across Wi-Fi, Ethernet, and other macOS network interfaces without creating a traditional VPN tunnel.

Built-in DNS profiles

The project includes popular choices such as Cloudflare, Google Public DNS, Quad9, and AdGuard DNS, with DoH or DoT profiles according to each provider’s support. Built-in profiles are read-only, preventing default data from being changed accidentally while editing a custom configuration.

Custom DoH and DoT profiles

You can also create a custom profile for your own resolver. The app validates the input before saving it:

  • A DoH profile must use a valid https:// endpoint.
  • A DoT profile must include a TLS server name and at least one bootstrap IP.
  • Each bootstrap server must be a valid IPv4 or IPv6 address.
  • A duplicate profile with the same name and protocol cannot be saved.

Custom data is stored only as JSON in the user’s Application Support directory. No account is required, and the configuration is not uploaded to a remote service.

Quick control from the menu bar

After enabling the menu bar control, you can check DNS status, connect or disconnect, change profiles, and refresh the system state without opening the main window. An installed system DNS configuration remains active even after the app is closed. To return to the original system DNS, select Disconnect in the app.

English and Traditional Chinese interfaces

The app includes Dashboard, DNS Profiles, Tutorial, Settings, and About screens in both English and Traditional Chinese. When the first connection requires system approval, the Tutorial points users to the exact location:

System Settings → Network → VPN & Filters → DNS Security Pro

What role did AI coding play in this project?

I did not enter a one-line prompt asking for a DNS app and accept whatever came back. I treated AI more like a collaborating engineer: define the product boundaries first, then review the architecture, features, and error states one step at a time.

I began with several non-negotiable requirements:

  1. It must be an independent, native macOS project—not a Mac Catalyst app.
  2. A single service must be responsible for writing system DNS settings so that state management does not spread across the views.
  3. Built-in profiles must be read-only; only custom profiles can be edited or deleted.
  4. DoH endpoints, DoT settings, and bootstrap IPs must be validated before a profile is saved.
  5. An unreadable system state must not be displayed as “DNS is disabled.”
  6. The UI, error messages, Tutorial, and README must use the same System Settings path.

Within these constraints, AI-assisted coding was useful for breaking down the SwiftUI screens, building the profile model, organizing local storage, filling in localization strings, and repeatedly running builds and static checks. The important part was not how much code could be generated at once, but whether each iteration could be checked against explicit rules.

The resulting structure is deliberately straightforward:

  • DNSProfile owns the data model and input validation.
  • DNSProfileRepository manages only custom profiles and the locally selected option.
  • SystemDNSManager is the only component that modifies macOS DNS preferences.
  • AppModel coordinates UI state, profile switching, and error handling.
  • SwiftUI views focus on the Dashboard, profile management, Tutorial, and menu bar experience.

This is where I find AI coding most valuable. It does not replace engineering judgment; it helps make requirements, architectural constraints, and validation steps more explicit so that every change has a clear basis for review.

How to use the macOS version

The source code is available in the GitHub repository. Open DNSSecurityProMac.xcodeproj, then select the DNS Security Pro macOS scheme to build the app.

For first-time setup:

  1. In DNS Profiles, select a built-in resolver or create a custom DoH or DoT profile.
  2. Return to the Dashboard and click Connect.
  3. If macOS asks for approval, go to System Settings → Network → VPN & Filters → DNS Security Pro and approve the configuration.
  4. Return to the app and refresh the status. A green shield and the message “Encrypted DNS is active” confirm that the configuration is enabled.

Installing a system DNS configuration requires Apple’s Network Extension dns-settings entitlement. Developers who sign and distribute their own builds still need an Apple Developer Team and a provisioning profile with the matching capability. The source code is available under the MIT License, but the product name, logo, and app icon are not included in that license.

Two versions are also available for iPhone and iPad

If you primarily use an iPhone or iPad, you can choose between my two iOS apps. Both use Apple’s system DNS functionality for DoH and DoT; they do not route unrelated traffic through the app’s own VPN server just to encrypt DNS.

DNS Security

DNS Security is the free version for trying the core encrypted DNS workflow. If you later need custom DNS, Wi-Fi SSID rules, and automation, you can unlock Pro with an in-app purchase.

DNS Security Pro

DNS Security Pro includes the Pro features with an upfront purchase. It is intended for users who already need custom DoH and DoT profiles, Wi-Fi SSID enable and disable rules, built-in profile updates, and quick switching through Shortcuts or URL schemes.

In short, start with DNS Security if you want to try it first. Choose DNS Security Pro if you already know that you need advanced configuration and automation.

Open source is not the finish line—it is another form of product validation

A DNS tool modifies system network settings, so appearing to work is not enough. The configuration format, system permissions, error states, storage location, and privacy boundaries all need to be inspectable.

Open-sourcing the native macOS version shares the result of this AI-assisted development process while also making the architecture and behavior available for review, discussion, and improvement. If you are interested in SwiftUI, NetworkExtension, encrypted DNS, or AI-assisted native app development, visit the GitHub repository and explore the code.