r/SwiftUI • • 16h ago

Promotion (must include link to source code) I built an open-source SwiftUI package for retro animated backgrounds

17 Upvotes

I made BRSRetro, a small library for iOS and macOS with a synthwave grid, digital rain, hyperspace, demoscene plasma, and a CRT overlay.

The grid, plasma, and CRT effects use Metal shaders; digital rain and hyperspace use Canvas. The animations also respect Reduce Motion.

You can add a background with .retroBackground(.synthwaveGrid) or use the individual views to adjust their parameters.

It’s MIT licensed, with the source here: github.com/brssgn/BRSRetro

I’d appreciate feedback on the API and rendering approach.


r/SwiftUI • • 19h ago

News SwiftUI Weekly - Issue #243

Thumbnail
open.substack.com
3 Upvotes

r/SwiftUI • • 1h ago

Tutorial I built a Hogwarts spellbook to show off custom spoiler reveals in Enriched Markdown, a native SwiftUI Markdown renderer Spoiler

Enable HLS to view with audio, or disable this notification

• Upvotes

Enriched Markdown for iOS renders Markdown natively in SwiftUI, including `||spoilers||`. By default they're hidden under a particle field, but you can swap the overlay for your own UIView and decide how hidden text looks and how it reveals itself.

To show what that unlocks, I built a Hogwarts spellbook: every spell in the video is a custom overlay revealing the same Markdown in its own way.

Not every app needs a Patronus, so here's a plain blur. It's one view subclass:

final class BlurOverlayView: SpoilerOverlayView {
  private static let context = CIContext()

  override func layoutSubviews() {
    super.layoutSubviews()
    guard let input = CIImage(image: concealedTextImage()) else { return }
    layer.contents = Self.context.createCGImage(
      input.applyingGaussianBlur(sigma: 6), from: input.extent
    )
  }
}

struct BlurOverlayProvider: SpoilerOverlayProvider {
  func makeOverlay(charRange: NSRange, style: SpoilerStyle) -> SpoilerOverlayView {
    let view = BlurOverlayView(charRange: charRange)
    view.backgroundColor = style.backgroundColor ?? .systemBackground
    return view
  }
}

EnrichedMarkdownText(markdown)
  .markdownSpoilerOverlay(BlurOverlayProvider())

concealedTextImage() gives you the hidden words laid out exactly where the text view draws them, so you can blur, pixelate, or scramble the real text and nothing jumps on reveal. For your own animation, override animateReveal(completion:).

Installation: https://docs.swmansion.com/enriched-markdown/ios/basics/installation

Docs: https://docs.swmansion.com/enriched-markdown/ios/api-reference/enriched-markdown-text#custom-spoiler-overlays

If it's useful to you, a ⭐ on GitHub helps more people find it: https://github.com/software-mansion/enriched-markdown


r/SwiftUI • • 2h ago

I built a window manager where the screen scrolls instead of the windows resizing (AppKit + SwiftUI)

0 Upvotes

The concept: the screen is a window onto a longer strip. Every window gets a full-height column, nothing ever resizes, and a three-finger swipe glides the strip one-to-one with your fingers.

Getting the glide to feel native was the whole project. It's AppKit for the windows and SwiftUI for the chrome (the settings window, the strip map that floats up while you move). A few things I learned along the way:

  • trackpad scroll events with momentum need custom handling to drive a window layout instead of a scroll view, and the one-to-one mapping is what makes it feel physical
  • keeping 60fps while repositioning real windows means doing very little per frame and letting springs do the animation
  • the map overlay renders the actual window geometry, so what you see in the map is literally the layout

It's $15 with a trial, and there's a working demo of the interaction on the site that you can drive with arrow keys (it's the real sizing/spring logic, in the browser): https://www.ribbonmac.com/

Happy to go deeper on any part of the implementation.