“Reparenting nested renderer host — preferences may be missing.” A SwiftUI Error

Christopher Truman
iOS App Development
2 min readJun 17, 2019

While playing around with the new SwiftUI framework introduced at WWDC 2019 recently, I’ve found myself running into this error over and over :

Reparenting nested renderer host — preferences may be missing. at /BuildRoot/Library/Caches/com.apple.xbs/Sources/Monoceros_Sim/Monoceros-5.104/Core/ViewGraph.swift:685

While building more complex layouts in SwiftUI, I’m seeing this error repeated over and over in the console:

I’ve been able to reliably produce this error message and break the SwiftUI rendering in a Playground when nesting a ScrollView inside another ScrollView like this:

I don’t fully understand the error, but I’m starting to. If I change the ScrollView to specify a frame, the error goes away and the view can render:

The error still prints a few times in the console, but now the playground can now render this:

What I don’t understand is why the error is still printed in the console. Is the SwiftUI rendering engine trying to determine the desired size of each View my iterating through all the child/parent objects until it finds a frame or other dimension limitation? Why do some errors break the renderer and some do not? I’ll update here if I can get more clarity on what this console message actually means.

Let me know on twitter if you have any guidance or tips for debugging issues like this!

--

--