Skip to content

SwiftUI

Xcode Preview – BSServiceConnectionErrorDomain error / crash

TL;DR Solution Add .environmentObject(AppData()) modifier to the preview struct. Preview Crash Recently, I ran into an issue where I couldn’t preview my changes after introducing non-static content. The error in question is Cannot preview in this file — The operation couldn’t be completed. (BSServiceConnectionErrorDomain error 3.) Naturally the next step is running the diagnostics which was a bit hairy because the Reveal… Read More »Xcode Preview – BSServiceConnectionErrorDomain error / crash

SwiftUI Property Wrappers

There’s no tl;dr for this topic since it does require some foundational knowledge. Donny Wals wrote up a great article at https://swiftuipropertywrappers.com on the differences and how to choose the right one for the occasion. @State @State property wrappers are great when no outside view will access the data hence should be marked private as follows @State private var username @Binding Passing… Read More »SwiftUI Property Wrappers