Search results for

swiftui

16,622 results found

Post

Replies

Boosts

Views

Activity

Reply to SwiftUI Instrumentation Fails to start
Some questions. By SwiftUI instrumentation, do you mean profile your app in Instruments with the SwiftUI instrument? What version of Xcode are you running? What version of iOS is the device running? The new SwiftUI instrument Apple added in Xcode 26 requires iOS 26+. If your device is running an earlier version of iOS, you can't use the new SwiftUI instrument. If you can't use the new SwiftUI instrument in Xcode 26, click the Add Instrument button above the timeline pane graphs and add the legacy View Body and View Properties instruments to profile the app. Also, remove the SwiftUI instrument from the trace.
Nov ’25
Picking image in iOS-first app when running it on macOS 26
An app that is capable of running on iPad can be usually run on Mac if properly designed and that's great. Recently I've tried to launch one of my old apps on macOS 26 in Designed for iPad mode and noticed that image picker behaves oddly. Images are barely selectable, you have to click several times and yet it might select image and might not. On iPhone and on iPad any kind of image picking works fine. I've tried all kinds of native pickers (PhotosPicker, PHPickerViewController, UIImagePickerController), but the result is almost the same. So how should I nowadays do image picking in (mostly) iOS app when it is run on macOS? Below is the most canonical and modern code I've tried. The issue is reproduced even with such bare minimum of code with the label not being put to a Form/List or any other factors. import SwiftUI import PhotosUI struct ContentView: View { @State private var selectedItem: PhotosPickerItem? @State private var selectedImage: UIImage? var body: some View { VStack { if let selectedIma
Topic: UI Frameworks SubTopic: SwiftUI Tags:
3
0
76
Nov ’25
NSOutlineView incorrectly draws disclosure indicator when item views are SwiftUI views.
I am using an NSOutlineView via NSViewRepresentable in a SwiftUI application running on macOS. Everything has been working fine. Up until lately, I've been returning a custom NSView for each item using the standard: func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? { // View recycling omitted. return MyItemView(item) } Now I want to explore using a little bit more SwiftUI and returning an NSHostingView from this delegate method. func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? { // View recycling omitted. let rootView = MySwiftUIView(item) let hostingView = NSHostingView(rootView: rootView) return hostingView } For the most part, this appears to be working fine. NSOutlineView is even correctly applying highlight styling, so that's great. But there's one small glitch. The outline view's disclosure triangles do not align with the hosting view's content. The disclosure triangle
1
0
139
Nov ’25
AVSpeechSynthesizer pulls words out of thin air.
Hi, I'm working on a project that uses the AVSpeechSynthesizer and AVSpeechUtterance. I discovered by chance that the AVSpeechSynthesizer automatically completes some words instead of just outputting what it's supposed to. These are abbreviations for days of the week or months, but not all of them. I don't want either of them automatically completed, but only the specified text. The completion transcends languages. I have written a short example program for demonstration purposes. import SwiftUI import AVFoundation import Foundation let synthesizer: AVSpeechSynthesizer = AVSpeechSynthesizer() struct ContentView: View { var body: some View { VStack { Button { utter(mon) } label: { Text(mon) } .buttonStyle(.borderedProminent) Button { utter(tue) } label: { Text(tue) } .buttonStyle(.borderedProminent) Button { utter(thu) } label: { Text(thu) } .buttonStyle(.borderedProminent) Button { utter(feb) } label: { Text(feb) } .buttonStyle(.borderedProminent) Button { utter(feb, lang: de-DE) } label: { Text(feb
1
0
207
Nov ’25
List Section with Swipe Action - glitches
Overview I have an iOS project where I have a list with sections. Each cell in the section can be swiped to have some action What needs to be done When swipe button is pressed the cell needs to move from one section to the other without a UI glitch. Problem When I press the swipe action button, there is a UI glitch and some warnings are thrown. UICollectionView internal inconsistency: unexpected removal of the current swipe occurrence's mask view. Please file a bug against UICollectionView. Reusable view: >; Collection view: ; backgroundColor = ; layer = ; contentOffset: {0, -62}; contentSize: {402, 229}; adjustedContentInset: {62, 0, 34, 0}; layout: ; dataSource: <_TtGC7SwiftUI31UICollectionViewListCoordinatorGVS_28CollectionViewListDataSourceOs5Never_GOS_19SelectionManagerBoxS2___: 0x106822a00>>; Swipe occurrence: {length = 2, path = 0 - 0}, state: .triggered, direction: left, offset: 0> Test environment: Xcode 26.0.1 (17A400) iOS 26 Simulator (iPhone 17 Pro) Feedback filed: FB20890361 Code
Topic: UI Frameworks SubTopic: SwiftUI
4
0
229
Nov ’25
Reply to How to build a Help view with hierarchical table of contents ?
The Keynote/Numbers/Pages apps for iPhone have a Help modal view that is very neat. Firstly I would like to know the format in which the Help content is stored. The “Apple Help Book” format is used for the macOS apps, but which format is used for the iOS apps ? Secondly I would like to know which SwiftUI API is used to build such a Help modal view. Where to find a SwiftUI example that is based on the same storage format ?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’25
App crashed when switching between Annotation Tab and Group Tab with TabView init(selection:content:)
This app will not crash when switching between these two tabs with TabView init(content:) import SwiftUI import SwiftData struct ContentView: View { @StateObject private var highlightManager = HighlightManager.shared @State private var selectedTab: Int = 0 var body: some View { TabView(selection: $selectedTab) { MapView() .tabItem { Label(Map, systemImage: map) } .tag(0) // Annotation Tab AnnotationList() .tabItem { Label(Annotation, systemImage: mappin.and.ellipse) } .tag(1) // Group Tab PeopleList() .tabItem { Label(Group, systemImage: person.and.person) } .tag(2) } .tutorialOverlay() // Apply the overlay to the root view .environmentObject(highlightManager) .toolbar { ToolbarItem(placement: .confirmationAction) { NavigationLink(Help) { NavigationStack { HelpView(selectedTab: selectedTab) } } } } } }
2
0
128
Nov ’25
Reply to List Section with Swipe Action - glitches
Possibly the same issue here. Sections not needed to reproduce issue with SwiftUI List in iOS 26, 26.0.1, and 26.1. Filed back in mid-August FB19602925 Minimal code to repro: struct Item: Identifiable, Hashable { var id: Int var title: String } struct ContentView: View { @State var items: [Item] = [ Item(id: 0, title: One), Item(id: 1, title: Two), Item(id: 2, title: Three), ] var body: some View { List(items) { item in Text(item.title) .swipeActions(edge: .trailing) { Button(Pin, systemImage: pin) { pinItem(item) } .tint(.green) Button(Copy, systemImage: document.on.document) { duplicateItem(item) } .tint(.blue) } } .listStyle(.plain) } func pinItem(_ item: Item) { if let idx = items.firstIndex(of: item) { items.move(fromOffsets: IndexSet(integer: idx), toOffset: 0) } } func duplicateItem(_ item: Item) { let newId = (items.map(.id).max() ?? 0) + 1 items.insert(Item(id: newId, title: Copy of (item.title)), at: 0) } }
Topic: UI Frameworks SubTopic: SwiftUI
Nov ’25
Downloading my fine tuned model from huggingface
I have used mlx_lm.lora to fine tune a mistral-7b-v0.3-4bit model with my data. I fused the mistral model with my adapters and upload the fused model to my directory on huggingface. I was able to use mlx_lm.generate to use the fused model in Terminal. However, I don't know how to load the model in Swift. I've used Imports import SwiftUI import MLX import MLXLMCommon import MLXLLM let modelFactory = LLMModelFactory.shared let configuration = ModelConfiguration( id: pharmpk/pk-mistral-7b-v0.3-4bit ) // Load the model off the main actor, then assign on the main actor let loaded = try await modelFactory.loadContainer(configuration: configuration) { progress in print(Downloading progress: (progress.fractionCompleted * 100)%) } await MainActor.run { self.model = loaded } I'm getting an error runModel error: downloadError(A server with the specified hostname could not be found.) Any suggestions? Thanks, David PS, I can load the model from the app bundle // directory: Bundle.main.resourceURL! but it's too bi
1
0
531
Oct ’25