krz/moonrise

Night-sky companion for iPhone, Apple Watch and Vision Pro: what's up tonight, the Moon, planets, launches and missions, and a Library of the solar system. SwiftUI app with a Cloudflare Workers backend. astronomy cloudflare-workers ios night-sky space swiftui visionos watchos

Commit 0b163eb74c

0b163eb74c364ea90396184b4796a70a662e594d

parent: f268ef43a3

Unsigned

cmc <hello@cleberg.net> · 2026-10-21 19:44 UTC

Globe: unlit material for the iPhone app on Vision Pro (!93)

In iPad compatibility mode on Vision Pro, "View as a globe" is black. When `ProcessInfo.isiOSAppOnVision` (iOS 26.1+) is true, the globe uses an unlit material. iPhone, iPad and the native visionOS app are unchanged.

Needs a check in the Vision Pro simulator before merging.

Layout: unified · split

App/Sources/GlobeView.swift +15
@@ -65,6 +65,13 @@ struct GlobeView: View {
6565 .navigationBarTitleDisplayMode(.inline)
6666 }
6767
68 private static var isiOSAppOnVision: Bool {
69 #if os(iOS)
70 if #available(iOS 26.1, *) { return ProcessInfo.processInfo.isiOSAppOnVision }
71 #endif
72 return false
73 }
74
6875 @MainActor
6976 static func makeGlobe(_ page: LibraryPage) async -> Entity {
7077 var material = PhysicallyBasedMaterial()
@@ -75,6 +82,14 @@ struct GlobeView: View {
7582 } else {
7683 material.baseColor = .init(tint: UIColor(Color(hex: page.drawing?.color ?? "") ?? .gray))
7784 }
85 // The iPhone app on Vision Pro draws the lit material black, so the globe is unlit there.
86 if page.id != "sun" && isiOSAppOnVision {
87 var unlit = UnlitMaterial()
88 unlit.color = .init(tint: material.baseColor.tint, texture: material.baseColor.texture)
89 let globe = ModelEntity(mesh: .generateSphere(radius: 0.5), materials: [unlit])
90 globe.name = "globe"
91 return globe
92 }
7893 if page.id == "sun" {
7994 var glow = UnlitMaterial(color: UIColor(Color(hex: page.drawing?.color ?? "") ?? .yellow))
8095 if let url = mapURL(page.id), let texture = try? await TextureResource(contentsOf: url) { glow.color = .init(texture: .init(texture)) }