Post

Replies

Boosts

Views

Activity

Search in a bottom toolbar
Dear all, The Search fields documentation appears to make a distinction between putting a search in a tab bar and in a bottom toolbar in an iOS device. Putting a search in a tab bar in iOS26 appears to be quick and easy: Tab(role: .search) { // Search } I cannot find, however, a way on how to put a search bar in a bottom toolbar (as illustrated here). The following code puts it in the top toolbar: .searchable(text: $searchQuery, placement: .toolbar) Same as this one: .searchable(text: $searchQuery, placement: .toolbarPrincipal) Do I miss something in this regard? Thanks!
1
0
121
Jun ’25
Scroll to top does not perform well with NavigationBarItem.TitleDisplayMode.large
Dear all, The scroll to top functionality of the tabItem does not scroll to the actual top of the view, when a list / scrollView is embedded in a tabView. Tapping the tabItem brings the view to the mid-point of the navigationTitle, leaving the navigationTitle half-blurred in the new iOS26: I believe that the same issue was present in previous iOS versions as well. Do you experience the same problem, or am I doing something wrong? The code is below. var body: some View { TabView { NavigationStack { List { ForEach(0..<100) { i in Text(i.formatted()) } } .navigationBarTitleDisplayMode(.large) .navigationTitle("List") } .tabItem { Label("List", systemImage: "list") // Tapping here while the list is scrolled down does not bring the entire list to the actual top } } } }
2
0
70
Jun ’25
PDF in WebView
Dear all, Is it possible to replace the default PDF background colour the 50% grey to any other colour while using the new WebView? Using the standard .background method on WebView does not appear to have any effect: WebView(pdfWebpage) .background(Color.blue) // no effect on the background of the PDF Thanks!
1
0
51
Jun ’25
onScrollVisibilityChange for Lists
I cannot make the new onScrollVisibilityChange work within Lists. Is this an expected limitation or am I doing something wrong? Please see the sample code below. Thank you! struct TestView: View { @State var isTitleVisible: Bool = true var body: some View { List { Section { Text("Title") } .onScrollVisibilityChange { isVisible in self.isTitleVisible = isVisible } Section { ForEach((0..<100), id: \.self) { i in Text(i.formatted()) } /// Changes the background color from green to red once the title is no more visible .listRowBackground(isTitleVisible ? Color.green : .red) } } } }
Topic: UI Frameworks SubTopic: SwiftUI
2
0
500
Sep ’24
Timestamps in AVPlayer
I want to show the user actual start and end dates of the video played on the AVPlayer time slider, instead of the video duration data. I would like to show something like this: 09:00:00 ... 12:00:00 (which indicates that the video started at 09:00:00 CET and ended at 12:00:00 CET), instead of: 00:00:00 ... 02:59:59. I would appreciate any pointers to this direction.
1
1
820
Sep ’23
Picker under the search bar
Dear all, I want to add a Picker view under the search bar similarly as seen on the Files app: I would be happy with one of the two options - 1) to have a picker view to be visible under the search bar all the time (ie. even when the search bar is not activated), 2) to have the picker view to be visible when search bar is active. I tried to implement this by using the toolbar modifier but without luck. NavigationView {     List {         ...     }     .searchable(text: $searchText)     .toolbar {         ToolbarItem {             Picker(selection: $selectedScope) {                 ...             } label: {                 ...             }             .pickerStyle(.segmented)         }     } } I have also tried the workaround by adding the Picker view within the List/Form but in this case the Picker view disappears when the user scrolls the list down.     List {         Section {             Picker(selection: $selectedScope) {                 ...             } label: {                 ...             }             .pickerStyle(.segmented)         }         ...     }     .searchable(text: $searchText) } One last thing I tried was to put the picker view within the search bar’s suggestions parameter. This however, obscures the search results under the suggestions view.     List {         ...     }     .searchable(text: $searchText), suggestions: Picker(selection: $selectedScope) {                 ...             } label: {                 ...             }             .pickerStyle(.segmented) }) } Any ideas?
0
0
1.8k
Oct ’21
Cannot enter zero value for Int64 record type
I have an app that uses Core Data integrated with CloudKit (public database). In one of the entities I have a boolean attribute, which is then "converted" to Int64 within the CloudKit dashboard. In the CloudKit Dashboard true values are marked as 1 and false values are marked as 0. In the previous version of the CloudKit dashboard I could change "true" (1) value to "false" (0) by simply entering zero (0) in the corresponding box. In the new version of the CloudKit it seems that this is not possible anymore as zero value is automatically deleted. This means that I cannot set any values to false (0) in the public database. Does anyone else has the same issue and knows any workarounds? Thanks.
1
0
891
Jun ’21
How to deallocate a Supplemenaty View?
Hello, I want to implement a footer supplementary view in a collection view in my app. I followed the example in the Modern Collection Views sample code and indeed the footer shows up perfectly. The problem arises when I implement a UIRefreshControl for the same collection view. This refresh control requests to 'reaply' the snapshot to the collection view. After this and several refreshes, all supplementary views show up perfectly again. However, when I check the 'Debug Memory Graph' section, I can see about 30-50 iterations of the custom Supplementary View. I added a deinit code within the custom supplementary view to check if it is called after reaplying the snapshot. It seems that it is applied only after 30-50 iterations of the custom supplementary views is reached in the Memory Graph. Is this a normal behaviour? Thank you.
0
0
598
Aug ’20