Search results for

[tags:apple pay,wallet]

18 results found

Post

Replies

Boosts

Views

Activity

Recommendations for showing asynchronously-fetched images
It's very clear from the session video how we can leverage cell configurations for information that is available synchronously, like titles for rows and locally-available images. Are there recommendations for how to configure cells for asynchronously-loaded stuff, for example fetching a user's profile picture from the internet? In the old style, we could subclass UITableViewCell and add an imageURL property, and then start loading the image immediately, with the ability to cancel the network request when prepareForReuse was called. I can imagine some ways to put this logic into the data source, but I think we'd have to do index-path accounting (or something) to keep track of which network request belongs to which cell, in order to deal with updating the cell's configuration on successful completion, as well as cancelling if the cell is going to be reused before loading completes. Are there better ways to approach this? Thanks!
1
0
1.8k
Jun ’20
Are Storyboard cell prototype styles also being deprecated?
I'm aware cell.textLabel is going to be deprecated from 25:40 in the video. I'm wondering in Storyboards is the cell prototype style also being deprecated? Because when I set cell.contentConfiguration it overrides the style chosen. Say if I chose the style right detail then when I set a configuration with a secondaryText then the cell appears as subtitle instead. Also, are Storyboards going to be deprecated in general?
1
0
871
Jun ’20
How to dynamically change the height of the section or group
How to dynamically change the height of the section or group when i use UICollectionViewCompositionalLayout. For example, i want to change the first section's height when i scroll the collectionview up. I can use the following code to achieve, but this looks very bad. // in didScroll callback collectionView.setCollectionViewLayout(currentCollectionViewLayout(), animated: true)
2
0
4.4k
Jun ’20
How to properly implement single update for a single cell with identifier?
Consider, that you have a struct that represents a Row. struct Row { tvar diffable: AnyHashable tvar yourDataProviderForCell: Provider } struct ListViewModel { tvar providers: [Provider] { didSet { self.rows = rowsFromProviders(self.providers) } } t@Published var rows: [Row] } So, it is simple, you have a list of providers that store all required information for cell. You encapsulate everything in ListViewModel, so, you could add this ListViewModel to your ViewController, right? class ListViewController { tvar viewModel: ListViewModel tfunc configured() { ttself.viewModel.$rows { ttt// Apply snapshot. tt} t} } Everything will ok fine when you add required protocols to Row: extension Row: Hashable { tfunc == (lhs: Self, rhs: Self) { ttlhs.diffable == rhs.diffable t} tfunc hash(inout hasher: Hasher) { tthasher.combine(self.diffable) t} } Look at what we have now. - ListViewController subscribed on @Published rows ListViewModel updates var providers and in didSet we update rows. Row has var diffable: AnyHashable
0
0
642
Jun ’20
Updating Cell Accessories after Configure?
I've got an asynchronous validation method that validates the underlying model of a cell when the cell is displayed on screen. When the validation completes, I modify the cell accessories to include an additional button that can be tapped for error details. This validation is invoked within a UICollectionView.CellRegistration. It seems that modifying the cell-accessories after the cell has returned (via the async completion handler) does not trigger a view update of said cell. Should it? Or is it better for me to persist this information in the model object and trigger a the snapshot update?
3
0
1.4k
Jul ’20
UIListContentConfiguration: Cell not showing updated text
I created a UIListContentConfiguration, set the initial text and set it on the cell. Then I updated the text and was expecting the cell to show the new text and sadly that didn't happen. Here is some sample code: (void)configureCell:(UITableViewCell *)cell withEvent:(Event *)event { ttUIListContentConfiguration *content = cell.defaultContentConfiguration; ttcontent.text = event.timestamp.description; ttcell.contentConfiguration = content; tt tt[self performSelector:@selector(updateTest:) withObject:content afterDelay:3]; } (void)updateTest:(UIListContentConfiguration *)content{ ttcontent.text = @Updated text; } Then I noticed that cell.contentConfiguration is a copy property type. Perhaps the API could be improved to change it to a strong property type, and have the cell do KVO on the configuration's text so we can update afterwards and the cell will automatically update to the new text. The same way as how MKAnnotation and MKAnnotationView works for its coordinate, title and subtitle.
3
0
2.1k
Jul ’20
Setting Background Configuration on Default UICollectionViewListCell for Various States
Here is my code currently. The problem is that the beige background color is there even when I select the cell. I know I should set a different background configuration for every state that I need to, but I don't know how for this default cell. I have created custom UICollectionViewListCells and set a different background on those depending on state. But can't figure out how to do that with the default cells. let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, CellItem> { (cell, indexPath, cellItem) in var content = cell.defaultContentConfiguration() content.text = cellItem.title content.secondaryText = cellItem.subText if let imageName = cellItem.imageName { content.image = UIImage(named: imageName) } cell.contentConfiguration = content cell.accessories = [.disclosureIndicator()] var backgroundConfig = UIBackgroundConfiguration.listGroupedCell() /* Set a beige background color to use the cell's tint color. */ backgroundConfig.backgroundColor = UIColor(named: CellColor) ba
3
0
3.1k
Jul ’20
Image vertical alignment in subtitleCell configuration
I am using the UIListContentConfiguration.subtitleCell() to display text, secondaryText and a SF Symbol as the image. The secondaryText is quite long in some cells so I would like to vertically align the symbol image to the top of the first line of text rather than the default where it is centered in the cell. Is it possible to override the vertical alignment/position of the image in UIListContentConfiguration.subtitleCell()?
1
0
1.4k
Jul ’20
Animations with cells configurations
I wonder how to make an animation on a view inside a cell visible on-screen based on iOS 14 cell configuration API. Imagine I want to animate the visibility of a placeholder view, in the old style, I would have write something like this: class MyCell: UICollectionViewCell { var placeholderVisible: Bool { get { return placeholderVisibleBackingValue } set { setPlaceholderVisible(newValue, animated: false) } } func setPlaceholderVisible(_ visible: Bool, animated: Bool) { placeholderVisibleBackingValue = visible updatePlaceHolderVisibility(animated: animated) } private func updatePlaceHolderVisibility(animated: Bool) { if animated { UIView.animate(withDuration: 0.5) { tttttt placeholderView.alpha = placeholderVisible ? 1 : 0 tttt } } else { placeholderView.alpha = placeholderVisible ? 1 : 0 } } } WWDC 2020 Modern Cell Configuration session briefly mentions animations at 09:09 time. It says that we can nest a configuration change inside an animation block. In practice, I'm not sure how I could do this because ever
2
0
1.9k
Aug ’20
What are the best practices for managing custom properties with cells configurations?
I'm not sure if I need to store any variable used in updateConfiguration(using:) in the custom key value store of UICellConfigurationState. I'm skeptical because some of these variables do not semantically represent a state. If I look at the sample WWDC sample code for custom cells configurations, all the variables used in updateConfiguration(using:) method are stored in the custom key value store of UICellConfigurationState. In fact, in this sample code, it's the whole model that it's stored in a state custom key. It seems weird because the base properties of UICellConfigurationState are real state properties: like selected, highlighted. In the same way, for the cells provided by UIKit, non state properties are stored in the configuration. For example, UIListContentConfiguration.imageProperties.tintColor, UIListContentConfiguration.imageToTextPadding. For a custom cell, we could imagine to subclass UIListContentConfiguration but it's not possible because it's a struct. Imagine you have a custom UICollectionV
5
0
5.2k
Aug ’20
Disabling selection for individual list cells
While converting some table views into collection view lists, I have run into an issue with managing which cells are expected to show a highlighted or selected background when being tapped. In this specific case, the list has a mix of cells where some have a traditional selection appearance and other should not show selection at all, but they should still be able to react to cell selection. The only workaround I have found is to override func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool. Is there a way to do this instead on the cell level?
1
0
5.3k
Aug ’20
Recommendations for showing asynchronously-fetched images
It's very clear from the session video how we can leverage cell configurations for information that is available synchronously, like titles for rows and locally-available images. Are there recommendations for how to configure cells for asynchronously-loaded stuff, for example fetching a user's profile picture from the internet? In the old style, we could subclass UITableViewCell and add an imageURL property, and then start loading the image immediately, with the ability to cancel the network request when prepareForReuse was called. I can imagine some ways to put this logic into the data source, but I think we'd have to do index-path accounting (or something) to keep track of which network request belongs to which cell, in order to deal with updating the cell's configuration on successful completion, as well as cancelling if the cell is going to be reused before loading completes. Are there better ways to approach this? Thanks!
Replies
1
Boosts
0
Views
1.8k
Activity
Jun ’20
How do modern cell configurations work with SwiftUI?
I'm new to SwiftUI, and I've seen a few new features that only seem to include UIKit examples, such as these content and background configurations. Is this because they are not necessary in SwiftUI, because they are not supported yet in SwiftUI, or is there a way to use cell configurations in SwiftUI that I'm missing?
Replies
1
Boosts
0
Views
373
Activity
Jun ’20
Where is the sample app mentioned in the video?
Not sure where to find it. Thanks
Replies
2
Boosts
0
Views
473
Activity
Jun ’20
Are Storyboard cell prototype styles also being deprecated?
I'm aware cell.textLabel is going to be deprecated from 25:40 in the video. I'm wondering in Storyboards is the cell prototype style also being deprecated? Because when I set cell.contentConfiguration it overrides the style chosen. Say if I chose the style right detail then when I set a configuration with a secondaryText then the cell appears as subtitle instead. Also, are Storyboards going to be deprecated in general?
Replies
1
Boosts
0
Views
871
Activity
Jun ’20
Is it possible to apply a custom UIContentConfiguration to UICollectionViewCell?
I am not asking about the UIKit-provided implementations of UIContentConfiguration. I am specifically asking if it is possible to: define a type that conforms to UIContentConfiguration apply an instance of that type to a plain-old UICollectionViewCell using the contentConfiguration property?
Replies
4
Boosts
0
Views
1.6k
Activity
Jun ’20
How to dynamically change the height of the section or group
How to dynamically change the height of the section or group when i use UICollectionViewCompositionalLayout. For example, i want to change the first section's height when i scroll the collectionview up. I can use the following code to achieve, but this looks very bad. // in didScroll callback collectionView.setCollectionViewLayout(currentCollectionViewLayout(), animated: true)
Replies
2
Boosts
0
Views
4.4k
Activity
Jun ’20
How to properly implement single update for a single cell with identifier?
Consider, that you have a struct that represents a Row. struct Row { tvar diffable: AnyHashable tvar yourDataProviderForCell: Provider } struct ListViewModel { tvar providers: [Provider] { didSet { self.rows = rowsFromProviders(self.providers) } } t@Published var rows: [Row] } So, it is simple, you have a list of providers that store all required information for cell. You encapsulate everything in ListViewModel, so, you could add this ListViewModel to your ViewController, right? class ListViewController { tvar viewModel: ListViewModel tfunc configured() { ttself.viewModel.$rows { ttt// Apply snapshot. tt} t} } Everything will ok fine when you add required protocols to Row: extension Row: Hashable { tfunc == (lhs: Self, rhs: Self) { ttlhs.diffable == rhs.diffable t} tfunc hash(inout hasher: Hasher) { tthasher.combine(self.diffable) t} } Look at what we have now. - ListViewController subscribed on @Published rows ListViewModel updates var providers and in didSet we update rows. Row has var diffable: AnyHashable
Replies
0
Boosts
0
Views
642
Activity
Jun ’20
NSCollectionViewGridLayout and Drag&Drop
Should one migrate to NSCollectionViewGridLayout from NSCollectionViewFlowLayout if there are Drag & Drop operations to reorder cells, or to insert new ones from an external source (i.e. another CollectionView). Is there sample code for NSCollectionViewGridLayout and Drag & Drop?
Replies
0
Boosts
0
Views
505
Activity
Jun ’20
Updating Cell Accessories after Configure?
I've got an asynchronous validation method that validates the underlying model of a cell when the cell is displayed on screen. When the validation completes, I modify the cell accessories to include an additional button that can be tapped for error details. This validation is invoked within a UICollectionView.CellRegistration. It seems that modifying the cell-accessories after the cell has returned (via the async completion handler) does not trigger a view update of said cell. Should it? Or is it better for me to persist this information in the model object and trigger a the snapshot update?
Replies
3
Boosts
0
Views
1.4k
Activity
Jul ’20
UIListContentConfiguration: Cell not showing updated text
I created a UIListContentConfiguration, set the initial text and set it on the cell. Then I updated the text and was expecting the cell to show the new text and sadly that didn't happen. Here is some sample code: (void)configureCell:(UITableViewCell *)cell withEvent:(Event *)event { ttUIListContentConfiguration *content = cell.defaultContentConfiguration; ttcontent.text = event.timestamp.description; ttcell.contentConfiguration = content; tt tt[self performSelector:@selector(updateTest:) withObject:content afterDelay:3]; } (void)updateTest:(UIListContentConfiguration *)content{ ttcontent.text = @Updated text; } Then I noticed that cell.contentConfiguration is a copy property type. Perhaps the API could be improved to change it to a strong property type, and have the cell do KVO on the configuration's text so we can update afterwards and the cell will automatically update to the new text. The same way as how MKAnnotation and MKAnnotationView works for its coordinate, title and subtitle.
Replies
3
Boosts
0
Views
2.1k
Activity
Jul ’20
Setting Background Configuration on Default UICollectionViewListCell for Various States
Here is my code currently. The problem is that the beige background color is there even when I select the cell. I know I should set a different background configuration for every state that I need to, but I don't know how for this default cell. I have created custom UICollectionViewListCells and set a different background on those depending on state. But can't figure out how to do that with the default cells. let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, CellItem> { (cell, indexPath, cellItem) in var content = cell.defaultContentConfiguration() content.text = cellItem.title content.secondaryText = cellItem.subText if let imageName = cellItem.imageName { content.image = UIImage(named: imageName) } cell.contentConfiguration = content cell.accessories = [.disclosureIndicator()] var backgroundConfig = UIBackgroundConfiguration.listGroupedCell() /* Set a beige background color to use the cell's tint color. */ backgroundConfig.backgroundColor = UIColor(named: CellColor) ba
Replies
3
Boosts
0
Views
3.1k
Activity
Jul ’20
Image vertical alignment in subtitleCell configuration
I am using the UIListContentConfiguration.subtitleCell() to display text, secondaryText and a SF Symbol as the image. The secondaryText is quite long in some cells so I would like to vertically align the symbol image to the top of the first line of text rather than the default where it is centered in the cell. Is it possible to override the vertical alignment/position of the image in UIListContentConfiguration.subtitleCell()?
Replies
1
Boosts
0
Views
1.4k
Activity
Jul ’20
Animations with cells configurations
I wonder how to make an animation on a view inside a cell visible on-screen based on iOS 14 cell configuration API. Imagine I want to animate the visibility of a placeholder view, in the old style, I would have write something like this: class MyCell: UICollectionViewCell { var placeholderVisible: Bool { get { return placeholderVisibleBackingValue } set { setPlaceholderVisible(newValue, animated: false) } } func setPlaceholderVisible(_ visible: Bool, animated: Bool) { placeholderVisibleBackingValue = visible updatePlaceHolderVisibility(animated: animated) } private func updatePlaceHolderVisibility(animated: Bool) { if animated { UIView.animate(withDuration: 0.5) { tttttt placeholderView.alpha = placeholderVisible ? 1 : 0 tttt } } else { placeholderView.alpha = placeholderVisible ? 1 : 0 } } } WWDC 2020 Modern Cell Configuration session briefly mentions animations at 09:09 time. It says that we can nest a configuration change inside an animation block. In practice, I'm not sure how I could do this because ever
Replies
2
Boosts
0
Views
1.9k
Activity
Aug ’20
What are the best practices for managing custom properties with cells configurations?
I'm not sure if I need to store any variable used in updateConfiguration(using:) in the custom key value store of UICellConfigurationState. I'm skeptical because some of these variables do not semantically represent a state. If I look at the sample WWDC sample code for custom cells configurations, all the variables used in updateConfiguration(using:) method are stored in the custom key value store of UICellConfigurationState. In fact, in this sample code, it's the whole model that it's stored in a state custom key. It seems weird because the base properties of UICellConfigurationState are real state properties: like selected, highlighted. In the same way, for the cells provided by UIKit, non state properties are stored in the configuration. For example, UIListContentConfiguration.imageProperties.tintColor, UIListContentConfiguration.imageToTextPadding. For a custom cell, we could imagine to subclass UIListContentConfiguration but it's not possible because it's a struct. Imagine you have a custom UICollectionV
Replies
5
Boosts
0
Views
5.2k
Activity
Aug ’20
Disabling selection for individual list cells
While converting some table views into collection view lists, I have run into an issue with managing which cells are expected to show a highlighted or selected background when being tapped. In this specific case, the list has a mix of cells where some have a traditional selection appearance and other should not show selection at all, but they should still be able to react to cell selection. The only workaround I have found is to override func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool. Is there a way to do this instead on the cell level?
Replies
1
Boosts
0
Views
5.3k
Activity
Aug ’20