How can one observe changes in the SwiftData DB?
I'm aware that this is possible via Queries, but I need to fetch the data in background, so a query is not an option.
I'm aware of the ModelContext.didSave / .willSave notifications, but these don't work with iOS 17.
-> How can I observe changes to models of a certain type? I don't want to observe the whole database.
Post
Replies
Boosts
Views
Activity
I'm showing several Steppers in a SwiftUI view on watchOS.
When the user taps the steppers & turns the digital crown it's possible to select multiple of the steppers (green "focus" border) appears.
I've tried to make the steppers mutually exclusive by using the following snippet, but it didn't work.
`@FocusState private var value: StepperType?`
[...]
var body: some View {
Form {
ForEach(StepperType.allCases, id: \.self) { stepperCase in
Stepper...
.focused($value, equals: stepperCase)
}
}
}
Any ideas how I can prevent multiple Steppers from being "focused" by the crown at the same time?
If a crash get's marked as "Resolved" in Xcode organizer:
Will it automatically get reopened if the same issue occurs again in a new/ later app version?
If yes: Where is this documented?
Hey everyone!
I'm trying to make an iOS app discoverable (in the App Library) with different keywords than its display name. I've experimented with CFBundleName, but it hasn't worked, and I couldn't find any official documentation on it.
Has anyone successfully done this or have any tips? I'd love to hear your insights!
I hope I'm wrong on this one, but as far as I understand watchOS is not able to collect/ capture Mach Exceptions and Signals. Which is the majority of crashes happening on watchOS.
I'm looking for a proper way to automatically receive crash reports from a watchOS app.
If this truly is a system limitation there's no way any tool can workaround it.
Does anyone know of a workaround or tool to automatically collect crashes on watchOS?
(I'm aware that it's possible to do so manually)
SwiftData offers a #Unique macro as of iOS 18, see here: https://developer.apple.com/documentation/swiftdata/unique(_:)
I was wondering if that one might work when the DB is backed by CloudKit.
I'm using NavigationLink(value:label:) and .navigationDestination(for:destination:) in my SwiftUI watchOS app.
However navigating in the app causes the system to emit the following errors to the console:
<NavigationHostingControllerCache>: MISS at depth 1 in free stack
[NavigationHostingControllerCache_UIKit] <_TtGC7SwiftUI32NavigationStackHostingControllerVS_7AnyView_: 0x125015000> containment skipped because sourceNavigationController or destination were nil or sourceNavigationController was equal to destination
[NavigationHostingControllerCache_UIKit] Eject called for index: depth 1 in free stack
Library: SwiftUI, Subsystem: com.apple.SwiftUI , Category: Invalid Configuration
The navigation itself does work fine.
I'm wondering there's something I can do to fix it or if this is an internal issue of the SwiftUI framework and cannot be addressed by me? (i.e. I can ignore this)
I'd like to learn how a Matter "Binding" can be created on iOS, e.g. via the "Matter" Framework.
I'm aware of the Matter Framework "Documentation" here.
But since it's missing any real description or documentation it's not helpful to me atm.
Any examples/ tutorials/ explanations are greatly appreciated.
SwiftData supports the unique attribute. Unfortunately that one is not available when using CloudKit for SwiftData.
I'm looking for some help (maybe an example) or best practices how to implement the same behavior.
I'm interested to learn more about this documentation:
https://developer.apple.com/apple-home/matter/
It contains a bunch of information and also some statements I'm curious about.
e.g. this one:
Matter accessories can be managed in the Settings app
Is the document referring to the iOS Settings app? I cannot find Matter accessories in the Settings App.
I'd also like to learn more about the APIs (which and how to use) this document is telling about. Is anybody able to help?
Since a while we're receiving crash reports from JavaScriptCore.
This seems to be related to us implementing WKScriptMessageHandlerWithReply (we're using the async variant).
Unfortunately the crash report is not helpful. Does anybody know why this is crashing?
One can see our custom code being called in step 9-11.
Unfortunately we cannot reproduce, seems to happen only rarely.
Crashed: com .apple.root.user-initiated-qos.cooperative
0 JavaScriptCore 0x110a2f8 JSC::sanitizeStackForVM(JSC::VM&) + 52
1 JavaScriptCore 0x3c2048 JSC::JSString::create(JSC::VM&, ***::Ref<***::StringImpl, ***::RawPtrTraits<***::StringImpl> >&&) + 412
2 JavaScriptCore 0x3c2048 JSC::JSString::create(JSC::VM&, ***::Ref<***::StringImpl, ***::RawPtrTraits<***::StringImpl> >&&) + 412
3 JavaScriptCore 0x49fcf4 JSValueMakeString + 128
4 JavaScriptCore 0x43b65c objectToValueWithoutCopy(JSContext*, objc_object*) + 976
5 JavaScriptCore 0x437b14 objectToValue(JSContext*, objc_object*) + 100
6 JavaScriptCore 0x2f6c +[JSValue valueWithObject:inContext:] + 40
7 WebKit 0x254af8 API::SerializedScriptValue::createFromNSObject(objc_object*) + 96
8 WebKit 0x2f2844 invocation function for block in ScriptMessageHandlerDelegate::didPostMessageWithAsyncReply(WebKit::WebPageProxy&, WebKit::FrameInfoData&&, API::ContentWorld&, WebCore::SerializedScriptValue&, ***::Function<void (API::SerializedScriptValue*, ***::String const&)>&&) + 184
9 Our App 0x666710 thunk for @escaping @callee_unowned @convention(block) (@unowned Swift.AnyObject?, @unowned NSString?) -> ()
10 Our App 0x666544 thunk for @escaping @callee_guaranteed (@in_guaranteed Any?, @guaranteed String?) -> ()
11 Our App 0x6661a8 @objc closure #1 in ScriptMessageHandler.userContentController(_:didReceive:)
12 libswift_Concurrency.dylib 0x3b7cc swift::runJobInEstablishedExecutorContext(swift::Job*) + 244
13 libswift_Concurrency.dylib 0x3c1e8 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
14 libdispatch.dylib 0x15164 _dispatch_root_queue_drain + 396
15 libdispatch.dylib 0x1596c _dispatch_worker_thread2 + 164
16 libsystem_pthread.dylib 0x1080 _pthread_wqthread + 228
17 libsystem_pthread.dylib 0xe5c start_wqthread + 8
Hi,
I'm trying to implement the async handler of WKScriptMessageHandlerWithReply -> see yellow box in this reference.
This is the method signature:
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) async -> (Any?, String?)
But I end up with a Segmentation fault: 11 compilation error.
I'm compiling with Xcode 13.4.1 (13F100).
Did anybody successfully use this API or now a solution to fix it?
Hi,
The WWDC2021 Video Add support for Matter in your smart home app has a bunch of code examples referencing APIs that are no longer present or deprecated, e.g. this one. Unfortunately the documentation doesn't give any hint on the replacement APIs.
Most of them are to be found in HMMatter* objects.
But in the video at 14:27 an API for CHIPDeviceController is shown. Unfortunately that one cannot be found anymore. Does anybody know how to achieve the described task (managing state and control of a matter accessory)
I'm looking for a tutorial or documentation on HMMatterRequestHandler. I'm aware of the brief mentions in wwdc21-10298 but it's not sufficient.
Is there any tutorial/ more extensive documentation?
I'm trying to commission a matter device via HMAccessorySetupRequest.performMatterEcosystemAccessorySetup.
After scanning the QR code via the system provided UI the app shows a system popup:
Additional Setup Required
This accessory required additional setup. Refer to the manufacturer's guide for more information
Unfortunately there's no further information. Did anybody succeed in using this API and could assist?