How we brought Datadog’s data visualization to iOS: A focus on performance
Datadog built DogGraphs, an internal SwiftUI graphing library constrained to iOS 14 (no Canvas), with a result-builder API that type-checks graph compositions at compile time. Profiling with _printChanges() and Xcode Instruments showed that layers observing a shared EnvironmentObject coordinate system caused twice the expected body evaluations (339 vs 113 for a 113-line chart). Moving coordinate-system reduction into the @resultBuilder via TupleGraphContent fixed that. For charts with thousands of bars, a Batch content type groups shapes by fill and stroke style and draws each group as a single Path, which removes the rendering hangs. The post also explains SwiftUI's diffing order: memcmp for POD views, then Equatable, then reflection.
Related posts
- Lessons From Building iOS Widgets
Shopify Engineering mediumAdeptShopify rebuilt its iOS analytics widgets natively in SwiftUI rather than React Native, because app extensions have tight memory limits, WidgetKit serializes SwiftUI view hierarchies, and React Native had no official widget support. Each widget fetches data independently through Reportify/ShopifyQL while sharing session tokens with the app. iOS calls getTimeline and getSnapshot several times per update cycle, which caused redundant network calls and a token-refresh race that logged users out. A one-minute per-widget cache keyed on configuration fixed both problems. The post also covers a flexible metric decoder, a size-agnostic SwiftUI layout built on LazyVGrid and an OptionSet of layout options, and why relative timestamps were rejected for lack of customization.
- Challenges of mixed SwiftUI and UIKit codebases in iOS Apps
Medium Engineering mediumAdeptMixing SwiftUI into Medium's 2013-era UIKit iOS app brings recurring friction: sizing SwiftUI views hosted in UIHostingController as table/collection cells, mismatched scroll APIs (offset sign differs), and duplicated components like PostPreview implemented in both frameworks. Medium keeps UIKit for app-wide navigation and SwiftUI for local feature navigation, avoids SwiftUI TextField due to focus limitations, and notes weaker SwiftUI view debugging. A scroll performance issue from wrapping UILabel with NSAttributedString in a SwiftUI list was fixed by switching to native Text with AttributedString; raising the minimum target from iOS 13 to 16 reduced version-specific code.
- DRUIDS, the design system that powers Datadog
Datadog Engineering easyNoviceDRUIDS (Datadog Reusable User Interface Design System) was started in 2018 to keep UX patterns consistent as Datadog grew into dozens of products, and its docs site is now public. Adoption across hundreds of designers and front-end developers depends on making the system easy to understand, implement and contribute to. Supporting tooling includes Cmd+K search, an in-app "Loupe" that highlights components with links to GitHub, Figma and VS Code, editable playgrounds and a sandbox treating React/TypeScript/CSS code as the source of truth, API tables auto-generated from component source, contribution guidelines, and a CLI that scaffolds new components.
- Swift at scale: building the TelemetryDeck analytics service
Swift.org mediumAdeptTelemetryDeck runs its privacy-focused app analytics service, covering over 16 million users a month, on Swift and Vapor in Kubernetes, with Postgres for metadata and Apache Druid for analytics data. Codable gives type-safe JSON parsing and validation. The team moved away from a shared client/server DTO package because API versioning made shared structs brittle, and now keeps DTOs inline in their controllers. Practical lessons include versioning API URLs from day one, leaning on Vapor's queues, migrations and Fluent, setting TTLs on every Redis cache entry, and adding error and performance monitoring with Swift Distributed Tracing, since the database and storage layers, not Swift, are usually the bottleneck.
- How we build SwiftUI features in the Medium application
Medium Engineering mediumAdeptMedium's iOS team builds new iOS 13+ features in SwiftUI and Combine by splitting a monolithic, partly Objective-C codebase into Swift packages: ApolloModel for generated GraphQL models, SharedUI components, per-feature UI packages, and planned LiveService/FakeService packages. Network services are structs returning Combine publishers, with live and fake implementations injected through initializers in a style inspired by Point-Free, rather than being registered in a global service registry. Views take protocol-backed GraphQL fragments so previews and tests can use simple structs, and enum action handlers forward events to custom UIHostingControllers for app-level navigation. Building packages in isolation makes SwiftUI previews fast, though List, NavigationView and Menu still have gaps that require OS-version workarounds.