Post

Replies

Boosts

Views

Activity

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) } } } }
2
0
213
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
650
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.7k
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
806
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
534
Aug ’20