u/Super-Storage6685

SwiftUI 3D is Flat (visionOS is not)
▲ 0 r/SwiftUI+1 crossposts

SwiftUI 3D is Flat (visionOS is not)

Short version: on iOS/macOS, SwiftUI's rotation3DEffect / projectionEffect give you per-view 2D projection of one rendered rectangle — not membership in a shared 3D scene. So you can flip one card convincingly, but a cube fails: with six faces there's no shared depth space and no per-frame depth sort.

The tell: render a pure-SwiftUI cube and sweep yaw. At 180° the front face is pointed away, but it still paints on top (declared-last wins), while a Core Animation cube shows the true back face. Painter's order vs depth sort.

The missing primitive has a name: CATransformLayer (non-flattening container) plus the parent sublayerTransform as a shared camera. Apple did build the richer model — transform3DEffect, Rotation3D, perspectiveRotationEffect — but shipped them visionOS-only. The boundary looks deliberate, not an oversight.

Full writeup with the CA-input → SwiftUI-output filter table, rendered witnesses, and a repo with positive (UIKit/AppKit + CA) and negative (pure SwiftUI) controls you can run:

https://aleahim.com/blog/swiftui-3d-is-flat/

u/Super-Storage6685 — 1 day ago
▲ 24 r/SwiftUI

The Morlocks Built SwiftUI

I went down a rabbit hole on Core Animation's origins and the through-line surprised me:

- It shipped in 2007 but predates the iPhone. John Harper built it under the codename "LayerKit" and Apple demoed it on the Mac at WWDC 2006. The patent (US 8,130,226) traces to a filing on Aug 4, 2006.

- Harper left for Facebook in 2014, came back, and in 2019 was on the WWDC stage explaining SwiftUI ("Building Custom Views with SwiftUI").

- SwiftUI never replaced Core Animation, it sits on top of it. Your `.animation()` still resolves to a `CAAnimation`; your views still become a layer tree on a render server that's barely changed since 2007.

My takeaway: SwiftUI isn't a dumbed-down toy, it's Core Animation's own implicit-animation philosophy made the default. The catch is the abstraction works until it doesn't, and the day it breaks it drops you straight into the layer tree.

I wrote it up (my blog): https://aleahim.com/blog/morlocks-built-swiftui/

u/Super-Storage6685 — 1 month ago