I’d like to create a simple Gantt chart where each horizontal BarMark is a navigation link to a detail view.
When I embed a navigation link within a chart, I get the error
“Static method 'buildExpression' requires that 'some ChartContent' conform to 'View’”
NavigationLink(value: taskGroup) {
BarMark(
xStart: .value("Start", taskGroup.start),
xEnd: .value("End", taskGroup.end),
y: .value("Event", taskGroup.taskGroupName),
height: barHeight
)
}
I could use a chart overlay and manage the navigation from there, but it appears I can only grab published chart data at a given tap gesture. I need the object itself to inject into the detail view (in this case TaskGroup) and the data I’m plotting in the chart isn’t unique - so no obvious way to identify which TaskGroup the user tapped.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
I have undoManager working with a CoreData backed app but I would like to either pause undoManager during certain data changes or be able to pop the last undo off the undoManager “stack".
Ideally, I would like to
Delete Object A
Pause undoManager
Delete Object B
Unpause undoManager
Delete Object C
So the undo stack looks like:
Undo Delete Object C
Undo Delete Object A
In this instance, object B was created by an unfinished multi-screen workflow that was canceled by the user - but there are a few other examples in my app as well.
So far I have tried disableUndoRegistration() like so:
container.viewContext.processPendingChanges()
container.viewContext.undoManager?.disableUndoRegistration()
This has no effect. The undo action is still recorded.
I have tried swapping the undoManager to nil after parking it elsewhere and then reassigning it after deleting object B. This effectively works the same as undoManager.removeAllActions().
And I have tried removing all actions for the target Object B after deleting Object B. Also with no effect.
viewContext.undoManager?.removeAllActions(withTarget: objectB)
My workaround is to simply reset the entire stack with .removeAllActions() but that’s not ideal.
Any ideas on how to make this work?
Thanks.
I’m trying to use the Link Presentation app in my SwiftUI app. When I try to fetch metadata, I get quite a few errors in the console. Here’s a stripped down version of the code that causes errors:
public struct URLMetadataLoader {
public static func metadata(for url: URL) async -> LPLinkMetadata? {
let metadataProvider = LPMetadataProvider()
do {
let metadata = try await metadataProvider.startFetchingMetadata(for: url)
return metadata
} catch {
print("Failed to get metadata for URL: \(error.localizedDescription)")
return nil
}
}
}
The errors I get on every call to fetch metadata are below.
Thanks.
Failed to resolve host network app id to config: bundleID: com.apple.WebKit.Networking instance ID: Optional([_EXExtensionInstanceIdentifier: 0501F943-B5B6-4F60-95B0-CDECFC2AE908])
Type: Error | Timestamp: 2024-10-07 12:17:36.877477-05:00 | Process: URLMetaDataMinimal | Library: ExtensionFoundation | Subsystem: com.apple.extensionkit | Category: default | TID: 0x1f1c18
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))" UserInfo={NSLocalizedFailureReason=((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))}>
0x12602cd80 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=80284, error: (null)
Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x600000c6fbd0 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}}
Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x600000c8cc60 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}}
Topic:
UI Frameworks
SubTopic:
General
I have an app that uses a couple of mlmodels (word tagger and gazetteer) and I’m trying to encrypt them before publishing.
The models are part of a package. I understand that Xcode can’t automatically handle the encryption for a model in a package the way it can within a traditional app structure.
Given that, I’ve generated the Apple MLModel encryption key from Xcode and am encrypting via the command line with:
xcrun coremlcompiler compile Gazetteer.mlmodel GazetteerENC.mlmodelc --encrypt Gazetteerkey.mlmodelkey
In the package manifest, I’ve listed the encrypted models as .copy resources for my target and have verified the URL to that file is good.
When I try to load the encrypted .mlmodelc file (on a physical device) with the line:
gazetteer = try NLGazetteer(contentsOf: gazetteerURL!)
I get the error:
Failed to open file: /…/Scanner.bundle/GazetteerENC.mlmodelc/coremldata.bin. It is not a valid .mlmodelc file.
So my questions are:
Does the NLGazetteer class support encrypted MLModel files?
Given that my models are in a package, do I have the right general approach?
Thanks for any help or thoughts.
Topic:
Machine Learning & AI
SubTopic:
Core ML