Provide views, controls, and layout structures for declaring your app's user interface using SwiftUI.

Posts under SwiftUI tag

200 Posts

Post

Replies

Boosts

Views

Activity

UIDesignRequiresCompatibility support clarification.
Hello, Could someone from Apple clarify the support and behavior of the UIDesignRequiresCompatibility property? The UIDesignRequiresCompatibility documentation states that this property will be ignored for builds targeting iOS 27 or later. I have a couple of questions: Does "builds targeting iOS 27 or later" refer to an app that was built using Xcode 27 or later? iOS 27 is expected to be released in Fall 2026. Suppose that after iOS 27 is released, I create a new build using Xcode 26, with UIDesignRequiresCompatibility set to true, and install that build on an iOS 27 device. Will UIDesignRequiresCompatibility still be honored in this scenario, or will it be ignored and the app will use the Liquid Glass UI? Thanks!
1
0
10
1s
ScrollView with a LazyVStack with Section does not respect initial scroll position
I have a ScrollView with a LazyVStack with Sections. I initialize the ScrollView with a scroll position but the ScrollView starts with the first row at the top. Am I doing something wrong or is this just a bug in ScrollView? It seems to work fine if I do not use Section. struct ContentView: View { @State var scrollPosition: ScrollPosition init() { var p = ScrollPosition(idType: Int.self) p.scrollTo(id: 500, anchor: .top) scrollPosition = p } var body: some View { ScrollView { LazyVStack { ForEach(0..<sectionCount, id: \.self) { j in Section { ForEach(0..<rowCount, id: \.self) { i in RowView(text: "\(j)/\(i) [\(j*rowCount+i)]") .id(j*rowCount+i) } } header: { HeaderView(title: "\(j)") } } } .scrollTargetLayout() } .scrollPosition($scrollPosition) } }
1
0
55
8h
SwiftUI's `scrollTo(id:anchor:)` doesn't work if the ScrollView is scrolling
Can somebody tell me if I'm doing something wrong or SwiftUI's scrollTo(id:anchor:) just doesn't work if the ScrollView is scrolling? I have a trivial example that demonstrates the issue: import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct Item: Identifiable { let id = UUID() let timestamp: Date let text: String } struct ContentView: View { @State private var items: [Item] = (0...10_000).map{ .init(timestamp: Date(), text: "Row \($0)") } @State private var scrollPosition = ScrollPosition(idType: Item.ID.self) @State private var newMessage: String = "" var body: some View { ScrollView { LazyVStack { ForEach(items) { item in ItemView(item: item) } }.scrollTargetLayout() } .defaultScrollAnchor(.bottom, for: .initialOffset) .scrollPosition($scrollPosition, anchor: .bottom) .safeAreaBar(edge: .bottom) { HStack { TextField("Type here", text: $newMessage, axis: .vertical) .textFieldStyle(.roundedBorder) Button("Send", action: { let trimmed = newMessage.trimmingCharacters(in: .whitespacesAndNewlines) guard !trimmed.isEmpty else { return } newMessage = "" items.append(.init(timestamp: .now, text: trimmed)) withAnimation(.smooth) { scrollPosition.scrollTo(id: items.last!.id, anchor: .bottom) } }) }.padding() } } } struct ItemView: View { let item: Item var body: some View { VStack(alignment: .leading) { Text(item.text) Text(item.timestamp.formatted()) }.padding() .frame(maxWidth: .infinity, alignment: .leading) .background(Color(red: .random(in: 0...1), green: .random(in: 0...1), blue: .random(in: 0...1))) } } #Preview { ContentView() }
1
0
28
8h
Introducing My Independent App Portfolio — Games, Education and Utilities
Hello Apple Developer Community, My name is Chris, and I’m an independent developer building games, educational tools, and utility apps for Apple platforms. I’d like to share some of the applications I have released so far: ADVENT Text Game for Mac A retro-inspired text adventure designed specifically for macOS. View on the App Store ADVENT Text Game for iPhone and iPad Explore mysterious caves, discover hidden passages, collect treasures, and solve puzzles in a classic-inspired text adventure. View on the App Store iFrappe View on the App Store China Driving Exam Trainer A study and practice application for learners preparing for the Chinese driving licence theory examination. View on the App Store Ur: The Royal Game A digital interpretation of the ancient Royal Game of Ur. View on the App Store I’m also currently developing Steel Maze, a retro maze-based tank battle game for iPhone, iPad, and Mac. Each project has helped me explore different parts of Apple development, including SwiftUI, SpriteKit, Mac Catalyst, responsive layouts, Game Center, gameplay design, and App Store distribution. I would be happy to receive feedback from other developers and connect with people working on similar independent projects. You can find my current app portfolio here: CK My Apps Thank you for taking a look!
0
0
17
13h
SwiftUI, macOS, PDFView, The "Remove Highlight" context menu does not work
I'm using PDFKitView: NSViewRepresentable to present the pdf page in SwiftUI. Seems we already have some useful built-in functions in the context menu. However, the highlight manipulation functions are not functional - I can neither delete the highlight annotation nor change the color/type of the current pointed highlight annotation. The "Add Note" and other page display changing functions work well.
1
1
915
2d
Lack of Native CJK Serif Font Support in WidgetKit (Font.design(.serif))
Hello everyone, I am encountering an inconsistent typography behavior when developing for WidgetKit. Specifically, there is no native serif font fallback for Chinese characters (CJK) in the Widget environment, whereas Latin characters are fully supported. When using the .serif design modifier in SwiftUI: Text("Hello 世界").font(.system(size: 16, design: .serif)) English/Latin characters ("Hello"): System correctly renders using the pre-installed serif font (New York). Chinese characters ("世界"): System ignores the .serif design and falls back to the default sans-serif font (PingFang SC). Can I find any pre-installed native serif font for CJK in iOS that I can reliably invoke within my Widget Extension without bundling .ttf files? If not, do you have plans to map Font.design(.serif) to a pre-installed CJK serif font in future iOS releases so I can maintain design consistency across my localized widgets? Thank you for any insights or recommended workarounds.
0
0
62
2d
requestReview() prompting repeatedly
We're getting user reports that the App Store rating prompt appears repeatedly — one user says they're prompted roughly every day, and that they still get the prompt after they've already left a rating. This contradicts the documented behavior, so I want to check whether others are seeing the same thing or whether there's a known regression. What the docs say should happen The system limits display to 3 occurrences per app within a 365-day period. For a user who has already rated/reviewed, StoreKit should only display again if the app version is new and more than 365 days have passed since their previous review. Has anyone else experience it?
2
0
293
3d
Detecting when the user lifted finger off the screen on a scrollview
I want to detect when the user stopped touching the screen. But I want it to be in a vertical ScrollView and a DragGesture isn't recognized when the view is scrolled vertically. I'm guessing this is because there wasn't anything dragged, since the view moved along with the user's finger. import SwiftUI struct TestView: View { var body: some View { ScrollView { VStack(spacing: 0) { Rectangle() .foregroundStyle(.green) .frame(height: 700) } } .gesture(DragGesture().onEnded({ _ in print("Drag gesture ended") })) } } How should I go about detecting when the user lifted their finger off the screen on a scrollview?
3
0
1.9k
3d
SwiftUI instrument in iOS27 betas "Failed to stop recording session: Data Providers emitted errors: Required"
i've been struggling to get the SwiftUI instrument to work during the betas. It never produces any results on simulator, while on device it throws an error which prevents any results from other instruments from appearing. the error is: Failed to stop recording session: Data Providers emitted errors: Required I've tried on my iPad Pro 11-inch (M4) (iPadOS27 beta 3), and iPhone 17 Pro Max (iPadOS27 beta 2). And I get the same result running from my mac studio & MacBook air. Is this a known thing? cheers, Mike
3
1
126
3d
SwiftUI Instruments Template doesn't work
I am profiling a simple SwiftUI test app on my new iPhone through my new MacBook Pro and everything is version 26.2 (iOS, macOS, Xcode). I run Instruments with the SwiftUI template using all of the default settings and get absolutely zero data after interacting with the app for about 20 seconds. Using the Time Profiler template yields trace data. Trying the SwiftUI template again with the sample Landmarks app has the same issue as my app.
3
1
735
3d
iOS 27 Beta Toggle in iOS Navigation Toolbar with custom label always appears selected
I've filed this as FB23714849 too, but I'm running into an issue with the Toggle component when displayed in a toolbar and a more complex label is used. This worked fine in iOS 26. Minimal repro example + screenshot: struct ContentView: View { @State var toggleState1 = false @State var toggleState2 = false var body: some View { NavigationStack { Text("Hello, world!") .toolbar { // THIS ITEM (leading) WORKS AS EXPECTED ToolbarItem(placement: .topBarLeading) { Toggle("Working", systemImage: "heart", isOn: $toggleState2) } // THIS ITEM (trailing) DOES NOT TOGGLE AS EXPECTED // It always appears enabled even when it should not ToolbarItem(placement: .topBarTrailing) { Toggle(isOn: $toggleState1) { Image(systemName: "star") } } } } } } My ultimate goal is to have a menu here where I can make the menu's label appear as a selected toggle (e.g. to display that one of a few filters is enabled). This is the case as of iOS Developer Beta 3 (and I believe the prior iOS 27 betas).
1
0
92
5d
How to style SwiftUI sidebar row selections like native macOS apps (Finder, Photos)
https://gist.github.com/MorusPatre/4b1e93973c3e4133794512fd7eefee48 This Is a Test App to find out how to actually achieve the exact sidebar styling Apple uses for Finder, Photos etc. The crucial part is how do I make it so the symbol and name of the selected row use the accent colour with active and inactive styling rather than having the accent colour for the row background? It shouldn't be that complicated I feel like but every AI model (even Claude Fable 5) fails at that and I haven't found apps or videos where that is explained so is that just a classic case of "Apple doesn't want you to know"?
2
0
178
6d
SwiftUI: safeAreaInset/safeAreaBar modifier used on a NavigationStack should automatically update the content inset (margins) of Views in the NavigationStack
[Submitted as FB23732628] Hello, In my app, I want a content to be always visible at the bottom of the UI such as a button (onboarding) or a mini player (Apple Music or Apple Podcasts). It should be visible even if I navigate to a destination view (using a NavigationLink or updating the NavigationStack path). And I don't use a TabView so I can't use the tabViewBottomAccessory. If I use the safeAreaInset/safeAreaBar modifier on the NavigationStack in SwiftUI, the content insets (margins) is not automatically updated for the Views within the stack. Expected behaviour: if I use the safeAreaInset/safeAreaBar, the Views in the NavigationStack should have their content inset (margins) updated like if the safeAreaInset/safeAreaBar is applied on the NavigationStack content directly. Steps to reproduce: check the attached project, scroll at the bottom of the first List, notice the content is hidden below the button. Navigate to the detail view, scroll at the bottom and notice the content is hidden below the button. Regards Axel import SwiftUI struct NavigationStackSafeAreaInset: View { var body: some View { NavigationStack { List { ForEach(0...20, id: \.self) { int in NavigationLink { List { ForEach(0...20, id: \.self) { int in Text(int.formatted()) } } } label: { Text(int.formatted()) } } } } .safeAreaInset(edge: .bottom) { Button { } label: { Text("New") .frame(maxWidth: .infinity) } .buttonStyle(.borderedProminent) .controlSize(.large) .buttonBorderShape(.capsule) .padding() } } } #Preview { NavigationStackSafeAreaInset() }
0
0
55
6d
SwiftUI confirmationDialog in List inside .sheet is no longer anchored to the originating row on iOS 27 beta
Area SwiftUI → Presentation / ConfirmationDialog Summary After building with Xcode 27 beta, confirmationDialog presented from a row inside a List that is embedded in a .sheet is no longer anchored to the row that triggered it. Instead, the dialog is displayed near the top of the sheet when the sheet is partially expanded, or in the center of the screen when the sheet occupies the full height. This behavior is reproducible across all tested Xcode 27 beta releases and iOS 27 beta releases (Beta 1, Beta 2, and Beta 3). Steps to Reproduce Present a SwiftUI .sheet. Place a List inside the sheet. Add a confirmationDialog to each list row. Trigger the dialog from a swipe action on any row. Observe the position where the confirmation dialog appears. A minimal reproducible sample project is attached. Expected Result The confirmationDialog should be visually associated with the row that triggered it, as it behaved in previous Xcode and iOS releases. The dialog should appear anchored to the selected list row (or as close as the platform allows), providing clear contextual feedback to the user about which item is being acted upon. Actual Result The dialog is no longer associated with the selected row. When the sheet is not fully expanded, the dialog appears near the top area of the sheet, seemingly positioned relative to the sheet itself rather than the triggering row. When the sheet is expanded to full height, the dialog appears in the center of the screen. As a result, the relationship between the selected item and the confirmation dialog is lost, creating a confusing user experience. Regression Yes. The same implementation behaved correctly in previous Xcode and iOS versions. The issue first appeared after upgrading to Xcode 27 beta and remains present in all tested iOS 27 beta releases (Beta 1–3). Impact This is a significant UX regression for existing applications that rely on contextual confirmation dialogs within lists presented inside sheets. Applications that already have production users cannot easily redesign their interaction model to compensate for this behavior change. The previous behavior provided clear context about which list item was being acted upon, while the current behavior makes that association unclear. Configuration Xcode 27 Beta (all tested beta versions) iOS 27 Beta 1 iOS 27 Beta 2 iOS 27 Beta 3 Reproduced on physical devices Reproduced using the attached minimal sample project Attachments Minimal reproducible sample project. Screenshot showing expected behavior (prior implementation). Screenshot showing current behavior on iOS 27 Beta 3. Screen recording demonstrating the regression. struct ContentView: View { @State private var sheetIsPresented = false @State private var itemPendingDeletion: Int? = nil var array = Array(0...100) var body: some View { VStack { Text("Hello, world!") Button("Show List") { sheetIsPresented = true } } .sheet(isPresented: $sheetIsPresented) { List { ForEach(array, id: \.self) { value in ListRow(for: value) .confirmationDialog("Delete?", isPresented: Binding( get: { itemPendingDeletion == value }, set: { isPresented in if !isPresented { itemPendingDeletion = nil } } ) ) { Button { } label: { Text("Delete") } } .swipeActions(edge: .trailing) { Button { itemPendingDeletion = value } label: { Image(systemName: "trash") .foregroundStyle(.red) } } } .listRowInsets(EdgeInsets()) .listRowBackground(Color.clear) } .listStyle(.inset) .contentMargins(16, for: .scrollContent) .presentationDetents([.fraction(1), .fraction(0.9)]) } } @ViewBuilder private func ListRow(for value: Int) -> some View { Text("\(value)") .foregroundStyle(.primary) .padding(.vertical) .frame(maxWidth: .infinity) .background( RoundedRectangle(cornerRadius: 26, style: .continuous) ) .padding(.vertical, 2) } } #Preview { ContentView() } Xcode 27(Beta 1,2,3) Xcode 26.5
1
0
136
6d
Previews for SwiftUI views in Packages don't work in Xcode 26.4
I have an iOS project based on SwiftUI in which almost all code is organised in Packages. With Xcode 26.2 and 26.3, I can preview all SwiftUI views without issues. With Xcode 26.4, the same previews don't work, in the canvas appears this error message: "Cannot preview in this file. Could not find target description for “TaskListView.swift”". The explanation is: "The list of source files that produce object files did not contain this file to be previewed. Check to make sure it is not excluded using the EXCLUDED_SOURCE_FILE_NAMES build setting." If I add a SwiftUI view to the main project files (not in a package), the preview works as expected. Is it an Xcode 26.4 regression? Or do I need to modify some configuration file?
8
1
683
1w
iOS 26: Interactive sheet dismissal causes layout hitch in underlying SwiftUI view
I’ve been investigating a noticeable animation hitch when interactively dismissing a sheet over a SwiftUI screen with moderate complexity. This was not the case on iOS 18, so I’m curious if others are seeing the same on iOS 26 or have found any mitigations. When dismissing a sheet via the swipe gesture, there’s a visible hitch right after lift-off. The hitch comes from layout work in the underlying view (behind the sheet) The duration scales with the complexity of that view (e.g. number of TextFields/layout nodes) The animation for programmatic dismiss (e.g. tapping a “Done” button) is smooth, although it hangs for a similar amount of time before dismissing, so it appears that the underlying work still happens. SwiftUI is not reevaluating the body during this (validated with Self._printChanges()), so that is not the cause. Using Instruments, the hitch shows up as a layout spike on the main thread: 54ms UIView layoutSublayersOfLayer 54ms └─ _UIHostingView.layoutSubviews 38ms └─ SwiftUI.ViewGraph.updateOutputs 11ms ├─ partial apply for implicit closure #1 in closure #1 │ in closure #1 in Attribute.init<A>(_:) 4ms └─ -[UIView For the same hierarchy with varying complexity: ~3 TextFields in a List: ~25ms (not noticeable) ~20+ TextFields: ~60ms (clearly visible hitch) The same view hierarchy on iOS 18 did not exhibit a visible hitch. I’ve tested this on an iOS 26.4 device and simulator. I’ve also included a minimum reproducible example that illustrates this: struct ContentView: View { @State var showSheet = false var body: some View { NavigationStack { ScrollView { ForEach(0..<120) { _ in RowView() } } .navigationTitle("Repro") .toolbar { ToolbarItem(placement: .topBarTrailing) { Button("Present") { showSheet = true } } } .sheet(isPresented: $showSheet) { PresentedSheet() } } } } struct RowView: View { @State var first = "" @State var second = "" var body: some View { VStack(alignment: .leading, spacing: 12) { Text("Row") .font(.headline) HStack(spacing: 12) { TextField("First", text: $first) .textFieldStyle(.roundedBorder) TextField("Second", text: $second) .textFieldStyle(.roundedBorder) } HStack(spacing: 12) { Text("Third") Text("Fourth") Image(systemName: "chevron.right") } } } } struct PresentedSheet: View { @Environment(\.dismiss) private var dismiss var body: some View { NavigationStack { List {} .navigationTitle("Swipe To Dismiss Me") .toolbar { ToolbarItem(placement: .topBarTrailing) { Button("Done") { dismiss() } } } } } } Is anyone else experiencing this and have any mitigations been found beyond reducing view complexity? I’ve filed a feedback report under FB22501630.
2
0
438
1w
NavigationStack has no animations or back gesture in macOS
When running a native macOS app using SwiftUI and a NavigationStack, clicking any links causes the contents of the stack to change immediately with no animation, and you can't use the usual two-finger swipe gesture to go back. The behavior is correct when running it as a Mac Catalyst app, you get the animated transitions when navigating, and swiping works. Minimal Example: (put this directly inside the WindowGroup) NavigationStack { VStack { NavigationLink { Rectangle().foregroundStyle(.red) } label: { Text("Button") } } }
1
0
134
1w
Did VisionOS27 get the LazyVGrid Performance Updates?
Did VisionOS get the LazyVGrid Performance Updates that other platforms received? I’m observing that a LazyVGrid that works well on iPhone, iPad, and Mac appears to hitch and jitter as cells exit and renter the lazyVGrid on VisionOS. It really feels like it did not get the same behavior changes as the other platforms. I observe the scrollbar expands as cells leave the top of the grid, and each “exit” of a row seems to cause a hitch. I’ve got rigidly defined cell frames, rigidly defined columns. I don’t think any cells frames are being invalidated during scroll… (there’s no way to check this with instruments, right?) I‘ve made several analysis passes myself and threw the Xcode Agent with Codex at it just to scan for stuff, but it’s starting to just guess at things. Any known issues with VisionOS?
3
0
137
1w
Changing a State var in a Timer block doesn't update the UI
Can anyone explain to me why my UI doesn't update after the timer fires in this code below? Even when the timer fires, the UI doesn't update. thanks, in advance for any guidance Mike struct ContentView: View { @State var referenceDate: Date = Date() init () { setupTimer() } func setupTimer() { let calendar = Calendar.current guard let triggerDate = calendar.nextDate( after: Date(), matching: DateComponents(hour: 14, minute: 46, second: 0), matchingPolicy: .nextTime ) else { return } let timer = Timer(fire: triggerDate, interval: 0.2, repeats: false) { _ in self.referenceDate = Date() print("runLoop!") } RunLoop.main.add(timer, forMode: .common) } var body: some View { VStack { Text("Ref time: \(referenceDate.formatted(date: .abbreviated, time: .standard))") } } }
2
0
119
1w
UIDesignRequiresCompatibility support clarification.
Hello, Could someone from Apple clarify the support and behavior of the UIDesignRequiresCompatibility property? The UIDesignRequiresCompatibility documentation states that this property will be ignored for builds targeting iOS 27 or later. I have a couple of questions: Does "builds targeting iOS 27 or later" refer to an app that was built using Xcode 27 or later? iOS 27 is expected to be released in Fall 2026. Suppose that after iOS 27 is released, I create a new build using Xcode 26, with UIDesignRequiresCompatibility set to true, and install that build on an iOS 27 device. Will UIDesignRequiresCompatibility still be honored in this scenario, or will it be ignored and the app will use the Liquid Glass UI? Thanks!
Replies
1
Boosts
0
Views
10
Activity
1s
ScrollView with a LazyVStack with Section does not respect initial scroll position
I have a ScrollView with a LazyVStack with Sections. I initialize the ScrollView with a scroll position but the ScrollView starts with the first row at the top. Am I doing something wrong or is this just a bug in ScrollView? It seems to work fine if I do not use Section. struct ContentView: View { @State var scrollPosition: ScrollPosition init() { var p = ScrollPosition(idType: Int.self) p.scrollTo(id: 500, anchor: .top) scrollPosition = p } var body: some View { ScrollView { LazyVStack { ForEach(0..<sectionCount, id: \.self) { j in Section { ForEach(0..<rowCount, id: \.self) { i in RowView(text: "\(j)/\(i) [\(j*rowCount+i)]") .id(j*rowCount+i) } } header: { HeaderView(title: "\(j)") } } } .scrollTargetLayout() } .scrollPosition($scrollPosition) } }
Replies
1
Boosts
0
Views
55
Activity
8h
SwiftUI's `scrollTo(id:anchor:)` doesn't work if the ScrollView is scrolling
Can somebody tell me if I'm doing something wrong or SwiftUI's scrollTo(id:anchor:) just doesn't work if the ScrollView is scrolling? I have a trivial example that demonstrates the issue: import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct Item: Identifiable { let id = UUID() let timestamp: Date let text: String } struct ContentView: View { @State private var items: [Item] = (0...10_000).map{ .init(timestamp: Date(), text: "Row \($0)") } @State private var scrollPosition = ScrollPosition(idType: Item.ID.self) @State private var newMessage: String = "" var body: some View { ScrollView { LazyVStack { ForEach(items) { item in ItemView(item: item) } }.scrollTargetLayout() } .defaultScrollAnchor(.bottom, for: .initialOffset) .scrollPosition($scrollPosition, anchor: .bottom) .safeAreaBar(edge: .bottom) { HStack { TextField("Type here", text: $newMessage, axis: .vertical) .textFieldStyle(.roundedBorder) Button("Send", action: { let trimmed = newMessage.trimmingCharacters(in: .whitespacesAndNewlines) guard !trimmed.isEmpty else { return } newMessage = "" items.append(.init(timestamp: .now, text: trimmed)) withAnimation(.smooth) { scrollPosition.scrollTo(id: items.last!.id, anchor: .bottom) } }) }.padding() } } } struct ItemView: View { let item: Item var body: some View { VStack(alignment: .leading) { Text(item.text) Text(item.timestamp.formatted()) }.padding() .frame(maxWidth: .infinity, alignment: .leading) .background(Color(red: .random(in: 0...1), green: .random(in: 0...1), blue: .random(in: 0...1))) } } #Preview { ContentView() }
Replies
1
Boosts
0
Views
28
Activity
8h
Introducing My Independent App Portfolio — Games, Education and Utilities
Hello Apple Developer Community, My name is Chris, and I’m an independent developer building games, educational tools, and utility apps for Apple platforms. I’d like to share some of the applications I have released so far: ADVENT Text Game for Mac A retro-inspired text adventure designed specifically for macOS. View on the App Store ADVENT Text Game for iPhone and iPad Explore mysterious caves, discover hidden passages, collect treasures, and solve puzzles in a classic-inspired text adventure. View on the App Store iFrappe View on the App Store China Driving Exam Trainer A study and practice application for learners preparing for the Chinese driving licence theory examination. View on the App Store Ur: The Royal Game A digital interpretation of the ancient Royal Game of Ur. View on the App Store I’m also currently developing Steel Maze, a retro maze-based tank battle game for iPhone, iPad, and Mac. Each project has helped me explore different parts of Apple development, including SwiftUI, SpriteKit, Mac Catalyst, responsive layouts, Game Center, gameplay design, and App Store distribution. I would be happy to receive feedback from other developers and connect with people working on similar independent projects. You can find my current app portfolio here: CK My Apps Thank you for taking a look!
Replies
0
Boosts
0
Views
17
Activity
13h
SwiftUI, macOS, PDFView, The "Remove Highlight" context menu does not work
I'm using PDFKitView: NSViewRepresentable to present the pdf page in SwiftUI. Seems we already have some useful built-in functions in the context menu. However, the highlight manipulation functions are not functional - I can neither delete the highlight annotation nor change the color/type of the current pointed highlight annotation. The "Add Note" and other page display changing functions work well.
Replies
1
Boosts
1
Views
915
Activity
2d
Lack of Native CJK Serif Font Support in WidgetKit (Font.design(.serif))
Hello everyone, I am encountering an inconsistent typography behavior when developing for WidgetKit. Specifically, there is no native serif font fallback for Chinese characters (CJK) in the Widget environment, whereas Latin characters are fully supported. When using the .serif design modifier in SwiftUI: Text("Hello 世界").font(.system(size: 16, design: .serif)) English/Latin characters ("Hello"): System correctly renders using the pre-installed serif font (New York). Chinese characters ("世界"): System ignores the .serif design and falls back to the default sans-serif font (PingFang SC). Can I find any pre-installed native serif font for CJK in iOS that I can reliably invoke within my Widget Extension without bundling .ttf files? If not, do you have plans to map Font.design(.serif) to a pre-installed CJK serif font in future iOS releases so I can maintain design consistency across my localized widgets? Thank you for any insights or recommended workarounds.
Replies
0
Boosts
0
Views
62
Activity
2d
requestReview() prompting repeatedly
We're getting user reports that the App Store rating prompt appears repeatedly — one user says they're prompted roughly every day, and that they still get the prompt after they've already left a rating. This contradicts the documented behavior, so I want to check whether others are seeing the same thing or whether there's a known regression. What the docs say should happen The system limits display to 3 occurrences per app within a 365-day period. For a user who has already rated/reviewed, StoreKit should only display again if the app version is new and more than 365 days have passed since their previous review. Has anyone else experience it?
Replies
2
Boosts
0
Views
293
Activity
3d
Detecting when the user lifted finger off the screen on a scrollview
I want to detect when the user stopped touching the screen. But I want it to be in a vertical ScrollView and a DragGesture isn't recognized when the view is scrolled vertically. I'm guessing this is because there wasn't anything dragged, since the view moved along with the user's finger. import SwiftUI struct TestView: View { var body: some View { ScrollView { VStack(spacing: 0) { Rectangle() .foregroundStyle(.green) .frame(height: 700) } } .gesture(DragGesture().onEnded({ _ in print("Drag gesture ended") })) } } How should I go about detecting when the user lifted their finger off the screen on a scrollview?
Replies
3
Boosts
0
Views
1.9k
Activity
3d
SwiftUI instrument in iOS27 betas "Failed to stop recording session: Data Providers emitted errors: Required"
i've been struggling to get the SwiftUI instrument to work during the betas. It never produces any results on simulator, while on device it throws an error which prevents any results from other instruments from appearing. the error is: Failed to stop recording session: Data Providers emitted errors: Required I've tried on my iPad Pro 11-inch (M4) (iPadOS27 beta 3), and iPhone 17 Pro Max (iPadOS27 beta 2). And I get the same result running from my mac studio & MacBook air. Is this a known thing? cheers, Mike
Replies
3
Boosts
1
Views
126
Activity
3d
SwiftUI Instruments Template doesn't work
I am profiling a simple SwiftUI test app on my new iPhone through my new MacBook Pro and everything is version 26.2 (iOS, macOS, Xcode). I run Instruments with the SwiftUI template using all of the default settings and get absolutely zero data after interacting with the app for about 20 seconds. Using the Time Profiler template yields trace data. Trying the SwiftUI template again with the sample Landmarks app has the same issue as my app.
Replies
3
Boosts
1
Views
735
Activity
3d
iOS 27 Beta Toggle in iOS Navigation Toolbar with custom label always appears selected
I've filed this as FB23714849 too, but I'm running into an issue with the Toggle component when displayed in a toolbar and a more complex label is used. This worked fine in iOS 26. Minimal repro example + screenshot: struct ContentView: View { @State var toggleState1 = false @State var toggleState2 = false var body: some View { NavigationStack { Text("Hello, world!") .toolbar { // THIS ITEM (leading) WORKS AS EXPECTED ToolbarItem(placement: .topBarLeading) { Toggle("Working", systemImage: "heart", isOn: $toggleState2) } // THIS ITEM (trailing) DOES NOT TOGGLE AS EXPECTED // It always appears enabled even when it should not ToolbarItem(placement: .topBarTrailing) { Toggle(isOn: $toggleState1) { Image(systemName: "star") } } } } } } My ultimate goal is to have a menu here where I can make the menu's label appear as a selected toggle (e.g. to display that one of a few filters is enabled). This is the case as of iOS Developer Beta 3 (and I believe the prior iOS 27 betas).
Replies
1
Boosts
0
Views
92
Activity
5d
An odd blur using inline searchbar iOS 26
When I use an inline search bar on a screen and the keyboard is opened, we can see an odd blur in the final place first before the keyboard finishes the move
Replies
1
Boosts
0
Views
79
Activity
6d
How to style SwiftUI sidebar row selections like native macOS apps (Finder, Photos)
https://gist.github.com/MorusPatre/4b1e93973c3e4133794512fd7eefee48 This Is a Test App to find out how to actually achieve the exact sidebar styling Apple uses for Finder, Photos etc. The crucial part is how do I make it so the symbol and name of the selected row use the accent colour with active and inactive styling rather than having the accent colour for the row background? It shouldn't be that complicated I feel like but every AI model (even Claude Fable 5) fails at that and I haven't found apps or videos where that is explained so is that just a classic case of "Apple doesn't want you to know"?
Replies
2
Boosts
0
Views
178
Activity
6d
SwiftUI: safeAreaInset/safeAreaBar modifier used on a NavigationStack should automatically update the content inset (margins) of Views in the NavigationStack
[Submitted as FB23732628] Hello, In my app, I want a content to be always visible at the bottom of the UI such as a button (onboarding) or a mini player (Apple Music or Apple Podcasts). It should be visible even if I navigate to a destination view (using a NavigationLink or updating the NavigationStack path). And I don't use a TabView so I can't use the tabViewBottomAccessory. If I use the safeAreaInset/safeAreaBar modifier on the NavigationStack in SwiftUI, the content insets (margins) is not automatically updated for the Views within the stack. Expected behaviour: if I use the safeAreaInset/safeAreaBar, the Views in the NavigationStack should have their content inset (margins) updated like if the safeAreaInset/safeAreaBar is applied on the NavigationStack content directly. Steps to reproduce: check the attached project, scroll at the bottom of the first List, notice the content is hidden below the button. Navigate to the detail view, scroll at the bottom and notice the content is hidden below the button. Regards Axel import SwiftUI struct NavigationStackSafeAreaInset: View { var body: some View { NavigationStack { List { ForEach(0...20, id: \.self) { int in NavigationLink { List { ForEach(0...20, id: \.self) { int in Text(int.formatted()) } } } label: { Text(int.formatted()) } } } } .safeAreaInset(edge: .bottom) { Button { } label: { Text("New") .frame(maxWidth: .infinity) } .buttonStyle(.borderedProminent) .controlSize(.large) .buttonBorderShape(.capsule) .padding() } } } #Preview { NavigationStackSafeAreaInset() }
Replies
0
Boosts
0
Views
55
Activity
6d
SwiftUI confirmationDialog in List inside .sheet is no longer anchored to the originating row on iOS 27 beta
Area SwiftUI → Presentation / ConfirmationDialog Summary After building with Xcode 27 beta, confirmationDialog presented from a row inside a List that is embedded in a .sheet is no longer anchored to the row that triggered it. Instead, the dialog is displayed near the top of the sheet when the sheet is partially expanded, or in the center of the screen when the sheet occupies the full height. This behavior is reproducible across all tested Xcode 27 beta releases and iOS 27 beta releases (Beta 1, Beta 2, and Beta 3). Steps to Reproduce Present a SwiftUI .sheet. Place a List inside the sheet. Add a confirmationDialog to each list row. Trigger the dialog from a swipe action on any row. Observe the position where the confirmation dialog appears. A minimal reproducible sample project is attached. Expected Result The confirmationDialog should be visually associated with the row that triggered it, as it behaved in previous Xcode and iOS releases. The dialog should appear anchored to the selected list row (or as close as the platform allows), providing clear contextual feedback to the user about which item is being acted upon. Actual Result The dialog is no longer associated with the selected row. When the sheet is not fully expanded, the dialog appears near the top area of the sheet, seemingly positioned relative to the sheet itself rather than the triggering row. When the sheet is expanded to full height, the dialog appears in the center of the screen. As a result, the relationship between the selected item and the confirmation dialog is lost, creating a confusing user experience. Regression Yes. The same implementation behaved correctly in previous Xcode and iOS versions. The issue first appeared after upgrading to Xcode 27 beta and remains present in all tested iOS 27 beta releases (Beta 1–3). Impact This is a significant UX regression for existing applications that rely on contextual confirmation dialogs within lists presented inside sheets. Applications that already have production users cannot easily redesign their interaction model to compensate for this behavior change. The previous behavior provided clear context about which list item was being acted upon, while the current behavior makes that association unclear. Configuration Xcode 27 Beta (all tested beta versions) iOS 27 Beta 1 iOS 27 Beta 2 iOS 27 Beta 3 Reproduced on physical devices Reproduced using the attached minimal sample project Attachments Minimal reproducible sample project. Screenshot showing expected behavior (prior implementation). Screenshot showing current behavior on iOS 27 Beta 3. Screen recording demonstrating the regression. struct ContentView: View { @State private var sheetIsPresented = false @State private var itemPendingDeletion: Int? = nil var array = Array(0...100) var body: some View { VStack { Text("Hello, world!") Button("Show List") { sheetIsPresented = true } } .sheet(isPresented: $sheetIsPresented) { List { ForEach(array, id: \.self) { value in ListRow(for: value) .confirmationDialog("Delete?", isPresented: Binding( get: { itemPendingDeletion == value }, set: { isPresented in if !isPresented { itemPendingDeletion = nil } } ) ) { Button { } label: { Text("Delete") } } .swipeActions(edge: .trailing) { Button { itemPendingDeletion = value } label: { Image(systemName: "trash") .foregroundStyle(.red) } } } .listRowInsets(EdgeInsets()) .listRowBackground(Color.clear) } .listStyle(.inset) .contentMargins(16, for: .scrollContent) .presentationDetents([.fraction(1), .fraction(0.9)]) } } @ViewBuilder private func ListRow(for value: Int) -> some View { Text("\(value)") .foregroundStyle(.primary) .padding(.vertical) .frame(maxWidth: .infinity) .background( RoundedRectangle(cornerRadius: 26, style: .continuous) ) .padding(.vertical, 2) } } #Preview { ContentView() } Xcode 27(Beta 1,2,3) Xcode 26.5
Replies
1
Boosts
0
Views
136
Activity
6d
Previews for SwiftUI views in Packages don't work in Xcode 26.4
I have an iOS project based on SwiftUI in which almost all code is organised in Packages. With Xcode 26.2 and 26.3, I can preview all SwiftUI views without issues. With Xcode 26.4, the same previews don't work, in the canvas appears this error message: "Cannot preview in this file. Could not find target description for “TaskListView.swift”". The explanation is: "The list of source files that produce object files did not contain this file to be previewed. Check to make sure it is not excluded using the EXCLUDED_SOURCE_FILE_NAMES build setting." If I add a SwiftUI view to the main project files (not in a package), the preview works as expected. Is it an Xcode 26.4 regression? Or do I need to modify some configuration file?
Replies
8
Boosts
1
Views
683
Activity
1w
iOS 26: Interactive sheet dismissal causes layout hitch in underlying SwiftUI view
I’ve been investigating a noticeable animation hitch when interactively dismissing a sheet over a SwiftUI screen with moderate complexity. This was not the case on iOS 18, so I’m curious if others are seeing the same on iOS 26 or have found any mitigations. When dismissing a sheet via the swipe gesture, there’s a visible hitch right after lift-off. The hitch comes from layout work in the underlying view (behind the sheet) The duration scales with the complexity of that view (e.g. number of TextFields/layout nodes) The animation for programmatic dismiss (e.g. tapping a “Done” button) is smooth, although it hangs for a similar amount of time before dismissing, so it appears that the underlying work still happens. SwiftUI is not reevaluating the body during this (validated with Self._printChanges()), so that is not the cause. Using Instruments, the hitch shows up as a layout spike on the main thread: 54ms UIView layoutSublayersOfLayer 54ms └─ _UIHostingView.layoutSubviews 38ms └─ SwiftUI.ViewGraph.updateOutputs 11ms ├─ partial apply for implicit closure #1 in closure #1 │ in closure #1 in Attribute.init<A>(_:) 4ms └─ -[UIView For the same hierarchy with varying complexity: ~3 TextFields in a List: ~25ms (not noticeable) ~20+ TextFields: ~60ms (clearly visible hitch) The same view hierarchy on iOS 18 did not exhibit a visible hitch. I’ve tested this on an iOS 26.4 device and simulator. I’ve also included a minimum reproducible example that illustrates this: struct ContentView: View { @State var showSheet = false var body: some View { NavigationStack { ScrollView { ForEach(0..<120) { _ in RowView() } } .navigationTitle("Repro") .toolbar { ToolbarItem(placement: .topBarTrailing) { Button("Present") { showSheet = true } } } .sheet(isPresented: $showSheet) { PresentedSheet() } } } } struct RowView: View { @State var first = "" @State var second = "" var body: some View { VStack(alignment: .leading, spacing: 12) { Text("Row") .font(.headline) HStack(spacing: 12) { TextField("First", text: $first) .textFieldStyle(.roundedBorder) TextField("Second", text: $second) .textFieldStyle(.roundedBorder) } HStack(spacing: 12) { Text("Third") Text("Fourth") Image(systemName: "chevron.right") } } } } struct PresentedSheet: View { @Environment(\.dismiss) private var dismiss var body: some View { NavigationStack { List {} .navigationTitle("Swipe To Dismiss Me") .toolbar { ToolbarItem(placement: .topBarTrailing) { Button("Done") { dismiss() } } } } } } Is anyone else experiencing this and have any mitigations been found beyond reducing view complexity? I’ve filed a feedback report under FB22501630.
Replies
2
Boosts
0
Views
438
Activity
1w
NavigationStack has no animations or back gesture in macOS
When running a native macOS app using SwiftUI and a NavigationStack, clicking any links causes the contents of the stack to change immediately with no animation, and you can't use the usual two-finger swipe gesture to go back. The behavior is correct when running it as a Mac Catalyst app, you get the animated transitions when navigating, and swiping works. Minimal Example: (put this directly inside the WindowGroup) NavigationStack { VStack { NavigationLink { Rectangle().foregroundStyle(.red) } label: { Text("Button") } } }
Replies
1
Boosts
0
Views
134
Activity
1w
Did VisionOS27 get the LazyVGrid Performance Updates?
Did VisionOS get the LazyVGrid Performance Updates that other platforms received? I’m observing that a LazyVGrid that works well on iPhone, iPad, and Mac appears to hitch and jitter as cells exit and renter the lazyVGrid on VisionOS. It really feels like it did not get the same behavior changes as the other platforms. I observe the scrollbar expands as cells leave the top of the grid, and each “exit” of a row seems to cause a hitch. I’ve got rigidly defined cell frames, rigidly defined columns. I don’t think any cells frames are being invalidated during scroll… (there’s no way to check this with instruments, right?) I‘ve made several analysis passes myself and threw the Xcode Agent with Codex at it just to scan for stuff, but it’s starting to just guess at things. Any known issues with VisionOS?
Replies
3
Boosts
0
Views
137
Activity
1w
Changing a State var in a Timer block doesn't update the UI
Can anyone explain to me why my UI doesn't update after the timer fires in this code below? Even when the timer fires, the UI doesn't update. thanks, in advance for any guidance Mike struct ContentView: View { @State var referenceDate: Date = Date() init () { setupTimer() } func setupTimer() { let calendar = Calendar.current guard let triggerDate = calendar.nextDate( after: Date(), matching: DateComponents(hour: 14, minute: 46, second: 0), matchingPolicy: .nextTime ) else { return } let timer = Timer(fire: triggerDate, interval: 0.2, repeats: false) { _ in self.referenceDate = Date() print("runLoop!") } RunLoop.main.add(timer, forMode: .common) } var body: some View { VStack { Text("Ref time: \(referenceDate.formatted(date: .abbreviated, time: .standard))") } } }
Replies
2
Boosts
0
Views
119
Activity
1w