I made a small project that freezes after the following steps:
Run the app
Turn on VoiceOver
Tap on "Header" once so it is read out loud
Turn off VoiceOver
Scroll up and down really quickly
Using the Time Profiler, the items in the Main Thread followed by significant drops are:
19.11 s 85.1% 0 s closure #2 in closure #1 in ViewRendererHost.render(interval:updateDisplayList:targetTimestamp:)
13.05 s 58.1% 4.00 ms ViewGraph.updateOutputs(async:)
7.97 s 35.5% 83.00 ms AG::Graph::UpdateStack::update()
5.76 s 25.6% 19.00 ms LayoutScrollableTransform.updateValue()
1.73 s 7.7% 2.00 ms specialized NativeDictionary.setValue(:forKey:isUnique:)
579.00 ms 2.6% 58.00 ms 0x100a8c908
311.00 ms 1.4% 165.00 ms __thread_stack_pcs
I see the memory usage increase by about 0.6 MB per second while frozen.
And there are a few things that prevent the freeze:
Changing LazyVStack for VStack
Removing the VStack from the Section
Removing the header: parameter from the Section
Reducing the range of the ForEach
Move the Text(verbatim: "Text at same level as ForEach containing Section") outside of the LazyVStack
However, these are all things I need to keep for my actual app. So what is causing this hang? Am I using SwiftUI in any way it's not intended to be used?
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
VStack(alignment: .leading) {
Image(systemName: "pencil.circle.fill")
Text("Title")
Text("Label")
}
ScrollView {
LazyVStack {
Section {
VStack {
ForEach(0..<70) { _ in
Text(verbatim: "A")
}
}
} header: {
Text(verbatim: "Header")
}
Text(verbatim: "Text at same level as ForEach containing Section")
}
}
}
}
}
AppDelegate:
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UINavigationController(rootViewController: MainViewController())
window.makeKeyAndVisible()
self.window = window
return true
}
}
MainViewController:
import UIKit
import SwiftUI
final class MainViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let swiftUIView = ContentView()
let hostingController = UIHostingController(rootView: swiftUIView)
addChild(hostingController)
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(hostingController.view)
NSLayoutConstraint.activate([
hostingController.view.topAnchor.constraint(equalTo: view.topAnchor),
hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor)
])
hostingController.didMove(toParent: self)
view.backgroundColor = .white
}
}
SwiftUI
RSS for tagProvide views, controls, and layout structures for declaring your app's user interface using SwiftUI.
Posts under SwiftUI tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Previously, I sorted my FetchResult in a TableView like this:
@FetchRequest(
sortDescriptors: [SortDescriptor(\.rechnungsDatum, order: .forward)],
predicate: NSPredicate(format: "betragEingang == nil OR betragEingang == 0")
)
private var verguetungsantraege: FetchedResults<VerguetungsAntraege>
...
body
...
Table(of:VerguetungsAntraege.self, sortOrder: $verguetungsantraege.sortDescriptors) {
TableColumn("date", value:\.rechnungsDatum) { item in
Text(Formatters.dateFormatter.string(from: item.rechnungsDatum ?? Date()) )
}
.width(120)
TableColumn("rechNrKurz", value:\.rechnungsNummer) { item in
Text(item.rechnungsNummer ?? "")
}
.width(120)
TableColumn("betrag", value:\.totalSum ) {
Text(Formatters.currencyFormatter.string(from: $0.totalSum as NSNumber) ?? "kein Wert")
}
.width(120)
TableColumn("klient") {
Text(db.getKlientNameByUUID(id: $0.klient ?? UUID(), moc: moc))
}
} rows: {
ForEach(Array(verguetungsantraege)) { antrag in
TableRow(antrag)
}
}
There seem to be changes here in Xcode 26. In any case, I always get the error message in each line with TableColumn("title", value: \.sortingField)
Ambiguous use of 'init(_:value:content:)'
Does anyone have any idea what's changed? Unfortunately, the documentation doesn't provide any information.
I'm developing a calculator app and working to ensure a great experience for both VoiceOver and Braille display users.
For expressions like (2+3)×5, I need two different accessibility outputs:
VoiceOver (spoken): A descriptive string like “left paren two plus three right paren times five,” provided via .accessibilityValue. I'm using a custom spellOut function since VoiceOver doesn't announce parentheses—which are kind of important when doing math!
Braille (symbolic): The literal math string (2+3)×5, provided using .accessibilityCustomContent("", ...), with an empty label so it’s not spoken aloud.
The issue: I don’t have access to a Braille display device and Xcode’s Accessibility Inspector doesn’t seem to show the custom content.
Is there any way to confirm that custom Braille content is being set correctly in Simulator or with other tools?
Or…is there a "math mode" in VoiceOver that forces it to announce parentheses?
Any advice or workarounds would be much appreciated!
Thanks,
Uhl
Topic:
Accessibility & Inclusion
SubTopic:
General
Tags:
External Accessory
iOS
Accessibility
SwiftUI
On iPadOS 26, dragging my draggable() View near the edge of the screen is causing a new window to open.
This doesn't happen with .onDrag on iPadOS 26, or with either .draggable() or .onDrag on iPadOS 18.5.
This is not something I'm intending to offer in my app, and doesn't really make sense. Is there any way to prevent this from happening? Is this a bug? I couldn't find any new documentation.
The thing being dragged: the "Font" rectangle on the right side of the screen, which represents an item in my app that is reorder-able when multiple are present.
I don't think the .searchable in the bottom bar / glass look works when you have TabView that has NavStack.
While editing the search text using the external keyboard (with VoiceOver on), if I try to navigate the to List using the keyboard, the focus jumps back to the search field immediately, preventing selection of list items. It's important to note that the voiceover navigation alone without a keyboard works as expected.
It’s as if the List never gains focus—every attempt to move focus lands back on the search field.
The code:
struct ContentView: View {
@State var searchText = ""
let items = ["Apple", "Banana", "Cherry", "Date", "Elderberry", "Fig", "Grape"]
var filteredItems: [String] {
if searchText.isEmpty {
return items
} else {
return items.filter { $0.localizedCaseInsensitiveContains(searchText) }
}
}
var body: some View {
if #available(iOS 16.0, *) {
NavigationStack {
List(filteredItems, id: \.self) { item in
Text(item)
}
.navigationTitle("Fruits")
.searchable(text: $searchText)
}
} else {
NavigationView {
List(filteredItems, id: \.self) { item in
Text(item)
}
.navigationTitle("Fruits")
.searchable(text: $searchText)
}
}
}
}
I'm a novice in RealityKit and ARKit. I'm using ARKit in SwiftUI to show a cube with a number as shown below.
import SwiftUI
import RealityKit
import ARKit
struct ContentView : View {
var body: some View {
return ARViewContainer()
}
}
#Preview {
ContentView()
}
struct ARViewContainer: UIViewRepresentable {
typealias UIViewType = ARView
func makeUIView(context: UIViewRepresentableContext<ARViewContainer>) -> ARView {
let arView = ARView(frame: .zero, cameraMode: .ar, automaticallyConfigureSession: true)
arView.enableTapGesture()
return arView
}
func updateUIView(_ uiView: ARView, context: UIViewRepresentableContext<ARViewContainer>) {
}
}
extension ARView {
func enableTapGesture() {
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTap(recognizer:)))
self.addGestureRecognizer(tapGestureRecognizer)
}
@objc func handleTap(recognizer: UITapGestureRecognizer) {
let tapLocation = recognizer.location(in: self) // print("Tap location: \(tapLocation)")
guard let rayResult = self.ray(through: tapLocation) else { return }
let results = self.raycast(from: tapLocation, allowing: .estimatedPlane, alignment: .any)
if let firstResult = results.first {
let position = simd_make_float3(firstResult.worldTransform.columns.3)
placeObject(at: position)
}
}
func placeObject(at position: SIMD3<Float>) {
let mesh = MeshResource.generateBox(size: 0.3)
let material = SimpleMaterial(color: UIColor.systemRed, roughness: 0.3, isMetallic: true)
let modelEntity = ModelEntity(mesh: mesh, materials: [material])
var unlitMaterial = UnlitMaterial()
if let textureResource = generateTextResource(text: "1", textColor: UIColor.white) {
unlitMaterial.color = .init(tint: .white, texture: .init(textureResource))
modelEntity.model?.materials = [unlitMaterial]
let id = UUID().uuidString
modelEntity.name = id
modelEntity.transform.scale = [0.3, 0.1, 0.3]
modelEntity.generateCollisionShapes(recursive: true)
let anchorEntity = AnchorEntity(world: position)
anchorEntity.addChild(modelEntity)
self.scene.addAnchor(anchorEntity)
}
}
func generateTextResource(text: String, textColor: UIColor) -> TextureResource? {
if let image = text.image(withAttributes: [NSAttributedString.Key.foregroundColor: textColor], size: CGSize(width: 18, height: 18)), let cgImage = image.cgImage {
let textureResource = try? TextureResource(image: cgImage, options: TextureResource.CreateOptions.init(semantic: nil))
return textureResource
}
return nil
}
}
I tap the floor and get a cube with '1' as shown below.
The background color of the cube is black, I guess. Where does this color come from and how can I change it into, say, red? Thanks.
hi everyone, any thought on how to implement a RichText(markdown) live editor using the new TextEditor(text: AttributedString, selection: AttributedTextSelection)?
Having issues like:
how to get the location of the selected text relatived to the TextEditor bounds, which is used to show and position a floating toolbar.
how to detect the cursor point is a new line and the content is "# ", (of couse now the user enter a space after the "#"), and if so, how to apply a H1 heading format to that line
much more issues like this, but these two are how to get me started, thanks
struct TextEditor8: View {
@State var text: AttributedString
@State var selection = AttributedTextSelection()
@State var isShowFloatingToolbar = false
@State var toolbarPosition: CGPoint = .zero
init() {
var text = AttributedString("Hello ✋🏻,Who is ready for Cooking?")
let range = text.characters.indices(where: \.isUppercase)
text[range].foregroundColor = .blue
_text = State(initialValue: text)
}
var body: some View {
ZStack(alignment: .topLeading) {
GeometryReader { geo in
TextEditor(text: $text, selection: $selection)
.onChange(of: selection, perform: { newV in
let v = text[newV]
if v.characters.isEmpty {
isShowFloatingToolbar = false
} else {
isShowFloatingToolbar = true
toolbarPosition = CGPoint(x: 20, y: 20) // how to get CGPoint relatived to TextEditor from selection
}
print("vvvv", v.characters.isEmpty)
})
}
if isShowFloatingToolbar {
FloatingToolbarAtSelection()
.position(toolbarPosition)
}
}
}
}
Hello,
I’m presenting the familyActivityPicker from a presented sheet in my application.
When I select some apps, categories or websites and tap “Done”, the familyActivityPicker is dismissed but the presenting sheet is also dismissed on iOS 18.4, iOS 18.5, iOS 26 beta 1 and 2. If I tap on “Cancel” from the familyActivityPicker, the sheet is also dismissed on iOS 18.4, iOS 18.5, iOS 26 beta 1 and 2.
The same code works perfectly fine on iOS 18.0, iOS 18.1, iOS 18.2 and iOS 18.3.
Is this a known-issue?
If opened the feedback FB18369821 for this.
Regards,
Axel
Topic:
App & System Services
SubTopic:
General
Tags:
SwiftUI
Family Controls
Managed Settings
Screen Time
When using the writingToolsBehavior API on a TextField and the app compiled with the iOS 26 SDK is run on an iOS 18 device, the app crashes with a symbol not found error.
It only crashes on the release build configuration and not on debug.
dyld[5274]: Symbol not found: _$s7SwiftUI17EnvironmentValuesV21_writingToolsBehaviorAA07WritingfG0VSgvg Referenced from: <1306655E-6DF7-3B2A-94A3-7202149E82F3> /private/var/containers/Bundle/Application/88E47904-4884-4279-9E96-0EC366970389/WritingToolsTest.app/WritingToolsTest Expected in: <165D3305-401E-37C2-8387-C1BFB54CFFDE> /System/Library/Frameworks/SwiftUI.framework/SwiftUI
Feedback ID: FB17980516
Hi,
I'm trying to create a custom bottom toolbar for my app and want to use same fade-blur effect as iOS uses under navigation and tab bars. Having trouble doing that.
Here is what I tried:
Screenshot 1: putting my custom view in a toolbar/ToolBarItem(placement: .bottomBar). This works only in NavigationStack, and it adds a glass pane that I do not want (I want to put a custom component there that already has correct glass pane)
Screenshot 2: using safeAreaBar or safeAreaInset in any combination with NavigationStack and/or .scrollEdgeEffectStyle(.soft, for: .bottom). Shows my component correctly, but does not use fade-blur.
Can you please help me to find out the correct way of doing that? Thanks!
^ Screenshot 1
^ Screenshot 2
Test code:
struct ContentView2: View {
var body: some View {
NavigationStack {
ScrollView(.vertical) {
VStack {
Color.red.frame(height: 500)
Color.green.frame(height: 500)
}
}
.ignoresSafeArea()
.toolbar() {
ToolbarItem(placement: .bottomBar) {
HStack {
Text("bottom")
Spacer()
Text("text content")
}
.bold().padding()
.glassEffect().padding(.horizontal)
}
}
}
}
}
I am trying out the new AttributedString binding with SwiftUI’s TextEditor in iOS26. I need to save this to a Core Data database. Core Data has no AttributedString type, so I set the type of the field to “Transformable”, give it a custom class of NSAttributedString, and set the transformer to NSSecureUnarchiveFromData
When I try to save, I first convert the Swift AttributedString to NSAttributedString, and then save the context. Unfortunately I get this error when saving the context, and the save isn't persisted:
CoreData: error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x600003721140> , <shared NSSecureUnarchiveFromData transformer> threw while encoding a value. with userInfo of (null)
Here's the code that tries to save the attributed string:
struct AttributedDetailView: View {
@ObservedObject var item: Item
@State private var notesText = AttributedString()
var body: some View {
VStack {
TextEditor(text: $notesText)
.padding()
.onChange(of: notesText) {
item.attributedString = NSAttributedString(notesText)
}
}
.onAppear {
if let nsattributed = item.attributedString {
notesText = AttributedString(nsattributed)
} else {
notesText = ""
}
}
.task {
item.attributedString = NSAttributedString(notesText)
do {
try item.managedObjectContext?.save()
} catch {
print("core data save error = \(error)")
}
}
}
}
I just wanted to post this here because since we started using SwiftUI, SwiftUI Previews have been painful to use, and then became basically unusable. And then after many hours of investigating, I seem to have found a solution and I wanted to share it somewhere useful.
The symptoms were that when clicking in the circle to enable preview (from the preview paused state) for any view, the progress spinner would sit there for... sometimes forever, but sometimes for 20 minutes before a preview would show.
It wasn't just slow, it was entirely unusable. Most of the complaints I've seen from other developers are about it being slow and unresponsive, but for us, it would just spin infinitely (rarely it would stop and then the preview would display). None of the 'fixes' here or on StackOverflow, etc helped.
So after a year of just mostly not using SwiftUI Previews, I found something interesting - under the build tab, the app was continually being rebuilt when the preview canvas with the spinner was being shown.
What?
OK, so it turns out we have a Run Script build step that generates output (a Credits.plist for open source libraries). It did not declare output files, which XCode had long complained about, but in general was not an issue... except apparently for SwiftUI Previews.
Checking the "For install builds. only" checkbox for this build step made the problem go away. That was it. SwiftUI Previews build and run fairly well now.
I have not tried fixing the complaint about the build script outputs - that might have also fixed the problem, but "For install builds only" definitely fixed our issue.
There is an issue with SwiftUI where it is incorrectly instantiating the navigation destination view with a new identity for a navigation stack that is being removed.
Here is a minimal reproducible example:
struct ContentView: View {
@State private var signedIn = false
var body: some View {
if signedIn {
navigationStack(isSignedIn: true)
} else {
navigationStack(isSignedIn: false)
}
}
private func navigationStack(isSignedIn: Bool) -> some View {
NavigationStack(path: .constant(NavigationPath([1]))) {
EmptyView()
.navigationDestination(for: Int.self) { _ in
VStack {
Text(isSignedIn ? "Signed In" : "Signed Out")
.foregroundStyle(Color.red)
Button(isSignedIn ? "Sign Out" : "Sign In") {
signedIn = !isSignedIn
}
}
.onFirstAppear {
print(isSignedIn ? "signed in" : "signed out")
}
}
}
}
}
struct OnFirstAppearView: ViewModifier {
@State private var hasAppeared = false
var onAppear: () -> Void
func body(content: Content) -> some View {
content
.onAppear {
if hasAppeared { return }
hasAppeared = true
onAppear()
}
}
}
extension View {
func onFirstAppear(_ onAppear: @escaping () -> Void) -> some View {
ModifiedContent(content: self, modifier: OnFirstAppearView(onAppear: onAppear))
}
}
When you launch the app it will print "signed out", but when you tap to Sign In it will print "signed out" and "signed in". This shows that onAppear is incorrectly being called for a view that is disappearing and worse yet, it is with a new identity.
The onFirstAppear modifier was created to help with detecting the identity change of the view.
Tested on Xcode 16.4, on simulator using iOS 18.5 and also on physical device using iOS 18.5.
Link to Feedback sent on Feedback Assistant: https://feedbackassistant.apple.com/feedback/18336684
Hi, has anyone noticed that when using SwiftUI the MapKit Marker created with
Marker(item: MKMapItem)
.tint(.red) //solid flat color
ignores the default marker styling (the nice gradient and shadow) and shows only a flat solid fill?
The shadow/gradient appears correctly with some colors like .blue or .orange, but disappears with others such as .red, .purple, etc.
What’s odd is that this happens only with the init(item: MKMapItem) initializer. A marker created with, for example, following init works just fine.
Marker("hello", coordinate: CLLocationCoordinate2D)
.tint(.red) //nice shadow/gradient
Is this a bug, or does a marker backed by an MKMapItem support only a limited color range? (If so, exposing .tint there seems inconsistent—either all colors should work or none.)
Has anyone else run into this problem?
.orange with shadow/gradient:
.red solid without shadow/gradient:
Hi all,
I’m trying to implement a collapsible section in a List on watchOS (watchOS 10+). The goal is to have a disclosure chevron that toggles a section open/closed with animation, similar to DisclosureGroup on iOS.
Unfortunately, DisclosureGroup is not available on watchOS. 😢
On iOS, this works as expected using this Section init:
Section("My Header", isExpanded: $isExpanded) {
// content
}
That gives me a tappable header with a disclosure indicator and the animation built in, as expected.
But on watchOS, this same init displays the header, but it’s not tappable, and no disclosure triangle appears.
I’ve found that to get it working on watchOS, I need to use the other initializer:
Section(isExpanded: $isExpanded) {
// content
} header: {
Button(action: { isExpanded.toggle() }) {
HStack {
Title("My Header")
Spacer()
Image(systemName: isExpanded ? "chevron.down" : "chevron.right")
}
}
That works, but feels like a workaround. Is this the intended approach for watchOS, or am I missing a more native way to do this?
Any best practices or alternative recommendations appreciated.
Thanks!
.navigationTitle disappears when using .toolbar and List inside NavigationStack (iOS 26 beta)
Summary
In iOS 26 beta, using .navigationTitle() inside a NavigationStack fails to render the title when combined with a .toolbar and a List. The title initially appears as expected after launch, but disappears after a second state transition triggered by a button press. This regression does not occur in iOS 18.
Steps to Reproduce
Use the SwiftUI code sample below (see viewmodel and Reload button for state transitions).
Run the app on an iOS 26 simulator (e.g., iPhone 16).
On launch, the view starts in .loading state (shows a ProgressView).
After 1 second, it transitions to .loaded and displays the title correctly.
Tap the Reload button — this sets the state back to .loading, then switches it to .loaded again after 1 second.
❌ After this second transition to .loaded, the navigation title disappears and does not return.
Actual Behavior
The navigation title displays correctly after the initial launch transition from .loading → .loaded.
However, after tapping the “Reload” button and transitioning .loading → .loaded a second time, the title no longer appears.
This suggests a SwiftUI rendering/layout invalidation issue during state-driven view diffing involving .toolbar and List.
Expected Behavior
The navigation title “Loaded Data” should appear and remain visible every time the view is in .loaded state.
✅ GitHub Gist including Screen Recording
👉 View Gist with full details
Sample Code
import SwiftUI
struct ContentView: View {
private let vm = viewmodel()
var body: some View {
NavigationStack {
VStack {
switch vm.state {
case .loading:
ProgressView("Loading...")
case .loaded:
List {
ItemList()
}
Button("Reload") {
vm.state = .loading
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
vm.state = .loaded
}
}
.navigationTitle("Loaded Data")
}
}
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Menu {
Text("hello")
} label: {
Image(systemName: "gearshape.fill")
}
}
}
}
}
}
struct ItemList: View {
var body: some View {
Text("Item 1")
Text("Item 2")
Text("Item 3")
}
}
@MainActor
@Observable
class viewmodel {
enum State {
case loading
case loaded
}
var state: State = .loading
init() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.state = .loaded
}
}
}
I’m testing .glassEffect() in a widget on the latest iOS 26 beta, but it seems to have no effect at all — the blur isn’t visible, and in some cases even white text disappears completely.
Is this the expected behavior for widgets (i.e. glass effect is not supported), or could this be a bug in the beta?
Would appreciate any clarification or pointers. Thanks!
Hi everyone,
I’m new to macOS development and working on an app idea that needs a timeline-based editor interface, similar to what you see in Logic Pro or Final Cut.
The UI I want to build would have:
A horizontal beat ruler that follows BPM and shows beat positions
Several vertical tracks stacked below it (for things like events or markers)
Horizontal zooming and scrolling
A preview panel on the right side that stays in sync with the timeline
I’m currently trying this in SwiftUI, but I’m running into some limitations and wondering if AppKit would be a better fit, or maybe a hybrid of the two.
My questions:
Where should I start when building something like this?
What’s the best way to make the beat ruler and all track layers scroll together?
How should I handle zooming in/out and syncing the display to a BPM timeline?
Is there a clean way to integrate AppKit for the timeline view while keeping SwiftUI elsewhere?
I have an AppIntent that edits an object in my app. The intent accepts an app entity as a parameter, so if you run the intent it will ask which one do you want to edit, then you select one from the list and it shows a dialog that it was edited successfully. I use this same intent in my Home Screen widget initializing it with an objectEntity. The code needs to run in the app's process, not the widget extension process, so the file is added to both targets and it conforms to ForegroundContinuableIntent, and that is supposed to ensure it always runs in the app process. This works great when run from the Shortcuts app and when involved via a button in the Home Screen widget, exactly as expected. Here is that app intent:
@available(iOS 17.0, *)
struct EditObjectIntent: AppIntent {
static let title: LocalizedStringResource = "Edit Object"
@Parameter(title: "Object", requestValueDialog: "Which object do you want to edit?", inputConnectionBehavior: .connectToPreviousIntentResult)
var objectEntity: ObjectEntity
init() {
print("INIT")
}
init(objectEntity: ObjectEntity) {
self.objectEntity = objectEntity
}
@MainActor
func perform() async throws -> some IntentResult & ReturnsValue<ObjectEntity> & ProvidesDialog {
// Edit the object from objectEntity.id...
return .result(value: objectEntity, dialog: "Done")
}
}
@available(iOS 17.0, *)
@available(iOSApplicationExtension, unavailable)
extension EditObjectIntent: ForegroundContinuableIntent { }
I now want to create a ControlButton that uses this intent:
struct EditObjectControlWidget: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "EditObjectControlWidget") {
ControlWidgetButton(action: EditObjectIntent()) {
Label("Edit Object", systemImage: "pencil")
}
}
}
}
When I add the button to Control Center and tap it (on iOS 18), init is called 3x in the app process and 2x in the widget process, yet the perform function is not invoked in either process. No error appears in console logs for the app's process, but this appears for the widget process:
LaunchServices: store <private> or url <private> was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
Attempt to map database failed: permission was denied. This attempt will not be retried.
Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
What am I doing wrong here? Thanks!
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
iOS
SwiftUI
WidgetKit
App Intents