I want to pass data of a class from parent View to children Views (children are in separate files) by using @ObservableObject / @ObservedObject. Do you have a typical example? What is wrong in the following coding or what is required to get it working:
class Einstellungen: ObservableObject {
@Published var scanDauer: Double = 10
… }
struct ContentView: View {
@ObservedObject var einstellungen = Einstellungen()
var body: some View {
NavigationView {
…
NavigationLink(destination: BLE_View()) { …
struct BLE_View: View {
@ObservedObject var einstellungen: Einstellungen
var body: some View {
After error “Missing argument for parameter 'einstellungen' in call”: If I add an argument to the call as shown, I get an error as:
NavigationLink(destination: BLE_View(einstellungen: Einstellungen)) { // Cannot convert value of type 'Einstellungen.Type' to expected argument type 'Einstellungen'
Similar issue for children. What corrections are required for parent and children including PreviewProvider?
Post
Replies
Boosts
Views
Activity
I wrote a watch-only App using Bluetooth wich is running on the watch. But no prints or logs appear on output.
I only get:
[S:1] Error received: Connection invalidated.
[S:3] Error received: Connection invalidated.
[S:4] Error received: Connection invalidated.
[S:5] Error received: Connection invalidated.
Message from debugger: killed
Program ended with exit code: 9
In the launch log I find:
Showing Recent Messages
Launch com.apple.Carousel
Platform: watchOS
Device Identifier: 00008310-001244D611D1A01E
Operating System Version: 10.5 (21T576)
Model: Apple Watch Series 9 (Watch7,1)
Apple Watch von Draha is connected via network
Installing com.apple.Carousel on Apple Watch von Draha
Installing on Apple Watch von Draha
Successfully installed
XPC/App Extension Debugging
Setup XPC Debugging for: gwe.WatchBleTest.watchkitapp.WatchBleWidget
Console logging policy: Synchronously obtain os_logs via libLogRedirect, and read stdio from File Descriptors
Stop XPC Debugging for: gwe.WatchBleTest.watchkitapp.WatchBleWidget
View debugging: disabled
Insert view debugging dylib on launch: enabled
Queue debugging: enabled
Memory graph on resource exception: disabled
Address sanitizer: disabled
Thread sanitizer: disabled
Using LLDBRPC. The LLDB framework is from /Applications/Xcode.app/Contents/SharedFrameworks
Device support directory: /Users/gertelsholz/Library/Developer/Xcode/watchOS DeviceSupport/Watch7,1 10.5 (21T576)/Symbols
Attached to process with pid 469
What could be the cause of the issue, and how to fix it?
Thanks for your help!