Post

Replies

Boosts

Views

Activity

Reply to The new navigationLinkIndicatorVisibility modifier crashes on < iOS 26
Seeing this crash in beta 8 (Xcode beta 7). Symbol not found: _$s7SwiftUI17EnvironmentValuesV33_navigationIndicatorVisibilityABIAA0G0OvpMV Referenced from: <35BAAD44-14F4-3B6C-8568-3E8B57A526ED> My call site: var allMerchantsSection: some View { Section { ForEach(model.paginatedMerchants.items) { merchant in NavigationLink(value: MerchantDestination.merchant(merchant)) { CardCell( image: .remote(url: merchant.info.bannerUrl), text: merchant.info.merchantName, description: nil, chipText: nil ) .navigationLinkIndicatorVisibility(.hidden) } .listRowBackground(Color.backgroundPrimary) .listRowSeparator(.hidden) .onAppear { if model.canLoadMore, merchant == model.paginatedMerchants.items.last { model.paginatedMerchants.currentPage += 1 } } } } header: { Text("All Merchants") } } made a feedback report: FB20108722
Topic: UI Frameworks SubTopic: SwiftUI
Sep ’25
Reply to Keep ScrollView position when adding items on the top
So I had a similar problem. I had a calendar-like view where the latest data is at the bottom. By default, it had 12 items in a LazyVGrid (3 rows of 4 items). You could tap "show more" to expand the size of the view to 600 in height, and also make it scrollable with the top view triggering a fetch of the next page of results. The problem was, the act of resizing this view, and triggering the next page of results was causing the scroll view to jump to the top, rather than staying at the bottom. So essentially it would start loading all pages infinitely. .scrollPosition and the ScrollViewProxy do not seem to work, because at the time of hitting "show more" the bottom is already visible, so the act of changing the scroll position does nothing. The only workaround I found here was to add a delay long enough for the resize animation and for enough results to load to prevent another page load from triggering. Unfortunately, this was not at all reliable. The only fix I have found was to use .defaultScrollAnchor(.bottom) which seems to cause the scroll view to default to the bottom when it's being redrawn rather than to the top. But unfortunately, we are on iOS 16, so I can't use that modifier either.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to plugin targets missing from swift-format dependency
Looks like the reason this happens is because the swift-format team created a COMMAND plugin. Instead of a BUILD plugin. If you right click on your package.swift file you should see an option in Xcode to run swift-format. I really want to use the official tooling with my projects. But time after time, it just seems like apple does not care about swift tooling. swift-format just seems to be a pain to work with. I can't even get it working with build phases. My script hits the line of code to trigger swift-format, but then nothing happens. Going to switch to SwiftLint
Feb ’24
Reply to SwiftUI List on maCOS: highlighting content in the selected row?
This isn't a built in feature, but I created an environment key called isSelected. The Environment is how most of the built in view modifiers work under the hood. struct SelectedEnvironmentKey: EnvironmentKey { static var defaultValue: Bool = false } extension EnvironmentKeys { var isSelected: Bool { get { self[SelectedEnvironmentKey.self] } set { self[SelectedEnvironmentKey.self] = newValue } } } then in the ForEach you can do: ForEach { myModel in RowView(model: myModel) .envrionment(\.isSelected, selection.contains(model)) } Then in your RowView struct RowView: View { @Environment(\.isSelected) private var isSelected var body: some View { // My views .background { if isSelected { return Color.blue } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’23
Reply to SwiftUI I want to display a loading screen on the entire screen when displaying a sheet
Not sure if this would work. But you could try something like this: struct LoadingPreferenceKey: PreferenceKey { var defaultValue: Bool = false static func reduce(value: inout Self.Value, nextValue: () -> Self.Value) { value = nextValue() } } struct RootView: View { @State var loading: Bool = false var body: some View { ContentView() .fullScreenCover(isPresented: $loading) { MyLoadingView() } .onPreferenceChange(LoadingPreferenceKey.self) { isLoading in loading = true } } } struct ContentView: View { @State private var showingSheet = false var body: some View { Button("Sheet Open") { self.showingSheet.toggle() } .sheet(isPresented: $showingSheet) { SheetView() } } } struct SheetView: View {   @State var isLoading = false var body: some View { ZStack{ VStack{ Text("SheetView") Button("Submit Data"){ isLoading = true // Submitting now...... isLoading = false } } if isLoading { ZStack{ Color.white.opacity(0.5) .ignoresSafeArea() .frame(width: geometry.size.width, height: geometry.size.height) ProgressView() } } } .preference(LoadingPreferenceKey.self, isLoading) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’23
Reply to UINavigationController has a delay rendering a UIHostingController's .navigationBarTitle(), .searchable(), and .toolbar()
I found a somewhat hacky workaround for this. You can "pre-render" the navigation bar customization so that it does not appear to pop in. This is not ideal though. Hopefully someone at apple fixes it. As it pretty much makes programmatic navigation in a mixed codebase impossible. let hostingController = UIHostingController(rootView: MyViewWithASearchBar()) hostingController.title = "My search page title" // pre-render the search bar let searchController = UISearchController() if #available(iOS 16.0, *) { hostingController.navigationItem.preferredSearchBarPlacement = .stacked } hostingController.navigationItem.searchController = searchController hostingController.navigationItem.hidesSearchBarWhenScrolling = false navigationController.pushViewController(hostingController, animated: true)
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’23
Reply to Xcode 26.1 RC issue
Seems this is still happening in the 26.2 beta as well.
Replies
Boosts
Views
Activity
Nov ’25
Reply to The new navigationLinkIndicatorVisibility modifier crashes on < iOS 26
Still happening in the live release of Xcode 26.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Sep ’25
Reply to The new navigationLinkIndicatorVisibility modifier crashes on < iOS 26
Seeing this crash in beta 8 (Xcode beta 7). Symbol not found: _$s7SwiftUI17EnvironmentValuesV33_navigationIndicatorVisibilityABIAA0G0OvpMV Referenced from: <35BAAD44-14F4-3B6C-8568-3E8B57A526ED> My call site: var allMerchantsSection: some View { Section { ForEach(model.paginatedMerchants.items) { merchant in NavigationLink(value: MerchantDestination.merchant(merchant)) { CardCell( image: .remote(url: merchant.info.bannerUrl), text: merchant.info.merchantName, description: nil, chipText: nil ) .navigationLinkIndicatorVisibility(.hidden) } .listRowBackground(Color.backgroundPrimary) .listRowSeparator(.hidden) .onAppear { if model.canLoadMore, merchant == model.paginatedMerchants.items.last { model.paginatedMerchants.currentPage += 1 } } } } header: { Text("All Merchants") } } made a feedback report: FB20108722
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Sep ’25
Reply to Keep ScrollView position when adding items on the top
So I had a similar problem. I had a calendar-like view where the latest data is at the bottom. By default, it had 12 items in a LazyVGrid (3 rows of 4 items). You could tap "show more" to expand the size of the view to 600 in height, and also make it scrollable with the top view triggering a fetch of the next page of results. The problem was, the act of resizing this view, and triggering the next page of results was causing the scroll view to jump to the top, rather than staying at the bottom. So essentially it would start loading all pages infinitely. .scrollPosition and the ScrollViewProxy do not seem to work, because at the time of hitting "show more" the bottom is already visible, so the act of changing the scroll position does nothing. The only workaround I found here was to add a delay long enough for the resize animation and for enough results to load to prevent another page load from triggering. Unfortunately, this was not at all reliable. The only fix I have found was to use .defaultScrollAnchor(.bottom) which seems to cause the scroll view to default to the bottom when it's being redrawn rather than to the top. But unfortunately, we are on iOS 16, so I can't use that modifier either.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to ForEach with binding seems to be broken in iOS 18.3.1 and iOS 18.4
It also happens if you use @Observable or @State for the source of your data. So its not an issue with ObservableObjects
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to TabView's page style is broken on iOS 17.4
It seems the bug is related to updating the source of the foreach while scrolling. The only workaround I have found so far is to pre-populate all of the possible pages before hand. But for an endless scroller that does not make much sense.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’24
Reply to Xcode 15.3 crippled with "internal inconsistency error"
I can't believe Xcode 15.3 shipped in this state. This is probably the buggiest Xcode release yet.
Replies
Boosts
Views
Activity
Mar ’24
Reply to plugin targets missing from swift-format dependency
Looks like the reason this happens is because the swift-format team created a COMMAND plugin. Instead of a BUILD plugin. If you right click on your package.swift file you should see an option in Xcode to run swift-format. I really want to use the official tooling with my projects. But time after time, it just seems like apple does not care about swift tooling. swift-format just seems to be a pain to work with. I can't even get it working with build phases. My script hits the line of code to trigger swift-format, but then nothing happens. Going to switch to SwiftLint
Replies
Boosts
Views
Activity
Feb ’24
Reply to SwiftUI List on maCOS: highlighting content in the selected row?
This isn't a built in feature, but I created an environment key called isSelected. The Environment is how most of the built in view modifiers work under the hood. struct SelectedEnvironmentKey: EnvironmentKey { static var defaultValue: Bool = false } extension EnvironmentKeys { var isSelected: Bool { get { self[SelectedEnvironmentKey.self] } set { self[SelectedEnvironmentKey.self] = newValue } } } then in the ForEach you can do: ForEach { myModel in RowView(model: myModel) .envrionment(\.isSelected, selection.contains(model)) } Then in your RowView struct RowView: View { @Environment(\.isSelected) private var isSelected var body: some View { // My views .background { if isSelected { return Color.blue } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to 403 errors when trying to download Xcode 15.1
3:18 PM EST, seems to be fixed for me (the developer portal link), App Store still broken. XcodesApp and Xcodes CLI still seems to be broken, but I think thats an issue on their end.
Replies
Boosts
Views
Activity
Dec ’23
Reply to SwiftUI I want to display a loading screen on the entire screen when displaying a sheet
Not sure if this would work. But you could try something like this: struct LoadingPreferenceKey: PreferenceKey { var defaultValue: Bool = false static func reduce(value: inout Self.Value, nextValue: () -> Self.Value) { value = nextValue() } } struct RootView: View { @State var loading: Bool = false var body: some View { ContentView() .fullScreenCover(isPresented: $loading) { MyLoadingView() } .onPreferenceChange(LoadingPreferenceKey.self) { isLoading in loading = true } } } struct ContentView: View { @State private var showingSheet = false var body: some View { Button("Sheet Open") { self.showingSheet.toggle() } .sheet(isPresented: $showingSheet) { SheetView() } } } struct SheetView: View {   @State var isLoading = false var body: some View { ZStack{ VStack{ Text("SheetView") Button("Submit Data"){ isLoading = true // Submitting now...... isLoading = false } } if isLoading { ZStack{ Color.white.opacity(0.5) .ignoresSafeArea() .frame(width: geometry.size.width, height: geometry.size.height) ProgressView() } } } .preference(LoadingPreferenceKey.self, isLoading) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to UINavigationController has a delay rendering a UIHostingController's .navigationBarTitle(), .searchable(), and .toolbar()
I found a somewhat hacky workaround for this. You can "pre-render" the navigation bar customization so that it does not appear to pop in. This is not ideal though. Hopefully someone at apple fixes it. As it pretty much makes programmatic navigation in a mixed codebase impossible. let hostingController = UIHostingController(rootView: MyViewWithASearchBar()) hostingController.title = "My search page title" // pre-render the search bar let searchController = UISearchController() if #available(iOS 16.0, *) { hostingController.navigationItem.preferredSearchBarPlacement = .stacked } hostingController.navigationItem.searchController = searchController hostingController.navigationItem.hidesSearchBarWhenScrolling = false navigationController.pushViewController(hostingController, animated: true)
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Allow custom tap gesture in List but maintain default selection gesture
This is super frustrating. Happens in iOS 17 beta as well. simultaneousGesture is supposed to solve this issue. Made a radar for it: FB12683243
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to Command plugin (XcodeCommandPlugin) do not appear in the contextual menu in Xcode 14.3
Can confirm this is happening to me as well on Xcode 14.3
Replies
Boosts
Views
Activity
Apr ’23
Reply to How to use UserDefaults.publisher in SwiftUI
is there a more dynamic way of doing this? adding a new extension on user defaults every time you have a new key isn't very scalable.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’23