Connect with Apple engineers to discuss the latest Apple technologies announced at WWDC21.

Posts under WWDC21 tag

73 Posts

Post

Replies

Boosts

Views

Activity

I'm unable to use the withTaskCancellaionHandler without a static analysis error
Hi, We have an API that I'm trying to prototype some async await extensions for. Most of our asynchronous methods are cancelable by returning an object that implements our AGSCancelable protocol that includes a cancel() method. Here's the code I have to try to extend a geocoding method on our AGSLocatorTask class: extension AGSLocatorTask { func geocode(withSearchText text: String) async throws -> [AGSGeocodeResult] { typealias GeocodeContinuation = CheckedContinuation<[AGSGeocodeResult], Error> var cancelable: AGSCancelable? return try await withTaskCancellationHandler(handler: { cancelable?.cancel() }, operation: { return try await withCheckedThrowingContinuation({ (continuation: GeocodeContinuation) in cancelable = self.geocode(withSearchText: text) { results, error in if let error = error { continuation.resume(throwing: error) } else { continuation.resume(returning: results!) } } }) }) } } This works great, but I have to comment out the cancelable?.cancel() call or else I get a Reference to captured var 'cancelable' in concurrently-executing code static analysis error (see attached screenshot). Could someone explain how to fix this, or is this a bug in the Xcode beta? Many thanks, and thanks for a great WWDC!!
4
0
1.8k
Dec ’21
Live Text capability
We have a question with respect to the Live Text feature shown in the Keynote. Is there an API or Framework available for this? Also, if there is a Framework/API available can we leverage it on macOS?
1
0
3.4k
Dec ’21
Manually set Safari 15 tab color-theme to my website
Hello. I was wondering if there is any way to manually set the Safari 15 tab color-theme color to my website. It seems like Safari automatically choose the color but I find out that this selection occurs during the first seconds of website load and, because of that, the color being choosen is not the right one for my website. Is there any CSS I could add or a metatag that tells safari which color it should pick? I know this is kinda a wierd request, but I want to provide my visitors the richest experience they could get. Thank you.
2
0
17k
Dec ’21
iOS 15, accelerate module, armv7, Xcode 13
Hi Team, Attempting to build our app with Xcode 13 / iOS 15, and getting a fail during archive, appearing to come from within the accelerate module. The two errors are: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Accelerate.swiftmodule/armv7-apple-ios.swiftinterface:591:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'   @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)    ^ in a number of places, and the following one, once: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Accelerate.swiftmodule/armv7-apple-ios.swiftinterface:1:1: error: failed to build module 'Accelerate'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5 (swiftlang-1300.0.17.216 clang-1300.0.18.1)', while this compiler is 'Apple Swift version 5.5 (swiftlang-1300.0.19.104 clang-1300.0.18.4)'). Please select a toolchain which matches the SDK. // swift-interface-format-version: 1.0 ^ This is Version 13.0 beta (13A5154h), doing a release build archive (dev build/run succeeds if that helps). Any insights into whats going on would be great? Cheers.
18
0
14k
Dec ’21
Custom fonts with AttributedString and Markdown
What is the best way to customize rendering of Markdown styles, in both UIKit and Swift? For instance, how should I tell it what font to use for normal and Bold text? This is what kept us from using NSAttributedString+HTML for embedded string formatting in the past, and AttributedString+Markdown looks even better for this use case, so I'm hoping the fact that we use a custom font won't be a roadblock. Is calling .replaceAttributes() the expected pattern, and just doing this for each expected attribute in each string?
3
0
5.4k
Nov ’21
Notifications for Web-Apps on iOS?
Notifications for native apps was released in 2009. It's now 2021 and we still have no indication when Web App Notifications are being developer let alone released. Service Workers and Notifications are already built and working in desktop safari. Given that the majority of apps require some sort of notification to be useful, is the safari team currently developing this feature and what is the planned release date?
5
0
2.9k
Nov ’21
How do I use async/await with NotificationCenter?
In the Meet AsyncSequence talk, there's a very cool use case that's shown in one of the slides - the new notifications property on NotificationCenter is an async sequence and the code sample does something like: let notification = await center.notifications(named: ....).first { ... } This seems really intriguing and useful to me but I had a few questions about the details of how this works: What is the type of notification in this snippet? A Task? Where would I store this value? What context should this be invoked in, especially if I want to have a long-running notification filter running that will remain active for the lifetime of the app? Basically, I'm curious to see an example of the code surrounding this snippet.
3
0
7.5k
Nov ’21
How can I tell if a StoreKit 2 purchase was completed on _this_ device?
In the session on StoreKit 2 (which looks amazing!), the presenter says: In fact, if your app is running when a purchase is made on another device, you'll be notified about the new transaction. This seems to mean that when an app uses the listener API to be notified of transactions, it will get transactions that happened on other devices. My app offers purchases across other platforms in addition to iOS, and when a purchase happens we register it with our own account system. If a user has the app running on both their iPad and iPhone and makes a purchase on the phone, if the iPad gets notified of it the same way it would of a purchase made on the iPad, both devices will try to report it to our system. This seems undesirable. What's the recommended approach here? Should we just make sure our system will disregard duplicate transaction reports? Or is there a way to know whether a transaction originated on this device? I don't see a property on the transaction type that looks like it could accomplish this. Maybe the deviceVerification properties? But that's seems more like the new edition of transaction receipt verification - failing that check would presumably mean that the purchase is invalid, not that it didn't happen on this device...?
2
0
3.2k
Nov ’21
User account deletion policy
Hi Apple is requiring Apps to offer an option to delete user's own account. However, account normally is tied to many different inter linked systems within an organization such as OMS, CRM, Marketing, promotion, 3rd party etc. What happens if someone inadvertently deletes an account but placed an order, or need to return an item.. Is a hard delete required or soft delete is i.e. disabling the account is acceptable to Apple. A prompt response would be greatly appreciated.
1
0
1k
Nov ’21
Erase all content and settings restrictions is not working in iOS 15
On applying the configuration profile(com.apple.applicationaccess - Restriction) with allowEraseContentAndSettings to false in iOS 15 device, the restriction is not imposed on supervised device. Can see restriction applied in Setting->General->VPN&Device management ->MDM profile-> Restriction. But on checking Setting->General->Reset Erase content and setting is shown. On clicking it the device has erased to factory setting. Have attached the mobileconfig and screenshots of the setting. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>PayloadContent</key> <array> <dict> <key>PayloadDescription</key> <string>Configures restrictions</string> <key>PayloadDisplayName</key> <string>Restrictions</string> <key>PayloadIdentifier</key> <string>com.apple.applicationaccess.8DA3EB9B-3C9E-45C1-99BC-B2A900E55628</string> <key>PayloadType</key> <string>com.apple.applicationaccess</string> <key>PayloadUUID</key> <string>8DA3EB9B-3C9E-45C1-99BC-B2A900E55628</string> <key>PayloadVersion</key> <integer>1</integer> <key>allowEraseContentAndSettings</key> <false/> </dict> </array> <key>PayloadDisplayName</key> <string>ContentRestriction</string> <key>PayloadIdentifier</key> <string>C7A744A3-0738-43C9-B962-DEBAABE63F4E</string> <key>PayloadRemovalDisallowed</key> <false/> <key>PayloadType</key> <string>Configuration</string> <key>PayloadUUID</key> <string>4BED8AF1-F1AC-4D2D-8B29-A130453BECB9</string> <key>PayloadVersion</key> <integer>1</integer> </dict> </plist> ![]("https://developer.apple.com/forums/content/attachment/d6e05749-559e-4428-95ad-96f304f36049" "title=IMG_0004.PNG;width=1668;height=2224") ![]("https://developer.apple.com/forums/content/attachment/3d4644b6-c074-486c-8010-1b843dc78c77" "title=IMG_0003.PNG;width=1668;height=2224") ` ![]("https://developer.apple.com/forums/content/attachment/a940b74b-3de0-4b52-b086-5e1102cb6ece" "title=IMG_0002.jpg;width=1668;height=2224") ``
3
0
2.4k
Oct ’21
AsyncImage with URLRequest?
I see in the docs that AsyncImage only takes in a URL, are there plans to expand the API to allow passing in a URLRequest, and possibly the URLSession as well? Our company's image server requires token authentication, which we pass as an HTTP header, so we're always constructing URLRequests and passing them to our custom URLSession.
2
0
1.1k
Oct ’21
Debugging on iOS 15 is terribly slow in Xcode
I'm using Xcode 12 with iPhone 12 Pro. Everything worked fine on iOS 14. But after I updated my device to iOS 15 I’m getting the app's splash screen for more than a minute every time I build the app. I've also tried to use Xcode 13 with the iOS 15 device, and it also seems to be broken!  Moreover, when I use a breakpoint and it stops I need to wait for 30-50 seconds to step over or to continue program execution. Does anyone have these problems too?
2
0
4.5k
Oct ’21
"xxx is only available in iOS 15.0 or newer"
I created a new iOS project targeting iOS 15 using Xcode 13.0 beta (13A5154h) on Big Sur to test some new SwiftUI features.  Xcode shows me the error like "xxx is only available in iOS 15.0 or newer" for all new API for iOS 15.  The project target is iOS 15  I tried to create another project again, same problem.  Would you please help to fix it?  Thanks a lot! Philipp
2
0
16k
Oct ’21
iOS 15 App Icon missing for Rich Notifications
For some reason on iOS 15 the app icon banner is missing for the expanded view on rich notifications. Toggling UNNotificationExtensionDefaultContentHidden back to false on the Content Extensions Info.plist causes the app icon to come back, but this isn't what we want since it also shows the original title & message. I've noticed that the Facebook notifications also have the same issues at the moment. I couldn't any documentation on why this changed. Attached is an example of a sample project where the App Icon is missing.
0
0
936
Oct ’21
Swift, iOS15, UIKit, CollectionView header issue
I am testing iOS15 and some new functionalities of UIKit. I've encountered some issues, not sure how to solve them. I did not change that code. This is just a piece of code that worked perfectly with the iOS 14, now after updating my target, it throws an error. Xcode crashes the moment when my custom header for the UICollectionView of type UICollectionElementKindSectionHeader is being returned for the dataSource. Here is my code: private func configureDataSource() { dataSource = UICollectionViewDiffableDataSource<Section, Follower>(collectionView: collectionView, cellProvider: { (collectionView, indexPath, followers) -> UICollectionViewCell? in let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FollowerCell.reuseId, for: indexPath) as! FollowerCell cell.set(on: followers) return cell }) dataSource.supplementaryViewProvider = { (collectionView, kind, indexPath) in let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: FollowersCollectionHeaderView.reuseId, for: indexPath) as! FollowersCollectionHeaderView header.set(with: self.user) return header } } The log says: the view returned from -collectionView:viewForSupplementaryElementOfKind:atIndexPath: does not match the element kind it is being used for. When asked for a view of element kind 'FollowersCollectionHeaderView' the data source dequeued a view registered for the element kind 'UICollectionElementKindSectionHeader'. I did cast UICollectionElementKindSectionHeader to FollowersCollectionHeaderView, therefore I am not sure what is the issue here. I've watched WWDC21 what's new in UIKit but haven't seen any mentioning of any change for that particular code. Any suggestions, what to fix in that code?
11
0
9.5k
Oct ’21
Enabling matter support in iOS 15
How do we get the appropriate profile to enable Matter support in the developer preview build of iOS 15? The talk mentions that this is required, but I'm not sure where to acquire the profile.
Replies
3
Boosts
0
Views
3.4k
Activity
Jan ’22
I'm unable to use the withTaskCancellaionHandler without a static analysis error
Hi, We have an API that I'm trying to prototype some async await extensions for. Most of our asynchronous methods are cancelable by returning an object that implements our AGSCancelable protocol that includes a cancel() method. Here's the code I have to try to extend a geocoding method on our AGSLocatorTask class: extension AGSLocatorTask { func geocode(withSearchText text: String) async throws -> [AGSGeocodeResult] { typealias GeocodeContinuation = CheckedContinuation<[AGSGeocodeResult], Error> var cancelable: AGSCancelable? return try await withTaskCancellationHandler(handler: { cancelable?.cancel() }, operation: { return try await withCheckedThrowingContinuation({ (continuation: GeocodeContinuation) in cancelable = self.geocode(withSearchText: text) { results, error in if let error = error { continuation.resume(throwing: error) } else { continuation.resume(returning: results!) } } }) }) } } This works great, but I have to comment out the cancelable?.cancel() call or else I get a Reference to captured var 'cancelable' in concurrently-executing code static analysis error (see attached screenshot). Could someone explain how to fix this, or is this a bug in the Xcode beta? Many thanks, and thanks for a great WWDC!!
Replies
4
Boosts
0
Views
1.8k
Activity
Dec ’21
Live Text capability
We have a question with respect to the Live Text feature shown in the Keynote. Is there an API or Framework available for this? Also, if there is a Framework/API available can we leverage it on macOS?
Replies
1
Boosts
0
Views
3.4k
Activity
Dec ’21
Where is the Focus Status API
In SOTU, a Focus Status API was announced for communication apps, but I haven't found any session nor documentation about it. Where can I find more information about that new API?
Replies
6
Boosts
0
Views
7.9k
Activity
Dec ’21
Manually set Safari 15 tab color-theme to my website
Hello. I was wondering if there is any way to manually set the Safari 15 tab color-theme color to my website. It seems like Safari automatically choose the color but I find out that this selection occurs during the first seconds of website load and, because of that, the color being choosen is not the right one for my website. Is there any CSS I could add or a metatag that tells safari which color it should pick? I know this is kinda a wierd request, but I want to provide my visitors the richest experience they could get. Thank you.
Replies
2
Boosts
0
Views
17k
Activity
Dec ’21
iOS 15, accelerate module, armv7, Xcode 13
Hi Team, Attempting to build our app with Xcode 13 / iOS 15, and getting a fail during archive, appearing to come from within the accelerate module. The two errors are: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Accelerate.swiftmodule/armv7-apple-ios.swiftinterface:591:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'   @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)    ^ in a number of places, and the following one, once: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Accelerate.swiftmodule/armv7-apple-ios.swiftinterface:1:1: error: failed to build module 'Accelerate'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5 (swiftlang-1300.0.17.216 clang-1300.0.18.1)', while this compiler is 'Apple Swift version 5.5 (swiftlang-1300.0.19.104 clang-1300.0.18.4)'). Please select a toolchain which matches the SDK. // swift-interface-format-version: 1.0 ^ This is Version 13.0 beta (13A5154h), doing a release build archive (dev build/run succeeds if that helps). Any insights into whats going on would be great? Cheers.
Replies
18
Boosts
0
Views
14k
Activity
Dec ’21
iOS 15 how to get the information of current focus mode?
I want to get information on the focus mode, such as the icon and title of the current focus mode. Are there APIs to do that?
Replies
1
Boosts
0
Views
745
Activity
Nov ’21
Custom fonts with AttributedString and Markdown
What is the best way to customize rendering of Markdown styles, in both UIKit and Swift? For instance, how should I tell it what font to use for normal and Bold text? This is what kept us from using NSAttributedString+HTML for embedded string formatting in the past, and AttributedString+Markdown looks even better for this use case, so I'm hoping the fact that we use a custom font won't be a roadblock. Is calling .replaceAttributes() the expected pattern, and just doing this for each expected attribute in each string?
Replies
3
Boosts
0
Views
5.4k
Activity
Nov ’21
Notifications for Web-Apps on iOS?
Notifications for native apps was released in 2009. It's now 2021 and we still have no indication when Web App Notifications are being developer let alone released. Service Workers and Notifications are already built and working in desktop safari. Given that the majority of apps require some sort of notification to be useful, is the safari team currently developing this feature and what is the planned release date?
Replies
5
Boosts
0
Views
2.9k
Activity
Nov ’21
How do I use async/await with NotificationCenter?
In the Meet AsyncSequence talk, there's a very cool use case that's shown in one of the slides - the new notifications property on NotificationCenter is an async sequence and the code sample does something like: let notification = await center.notifications(named: ....).first { ... } This seems really intriguing and useful to me but I had a few questions about the details of how this works: What is the type of notification in this snippet? A Task? Where would I store this value? What context should this be invoked in, especially if I want to have a long-running notification filter running that will remain active for the lifetime of the app? Basically, I'm curious to see an example of the code surrounding this snippet.
Replies
3
Boosts
0
Views
7.5k
Activity
Nov ’21
How can I tell if a StoreKit 2 purchase was completed on _this_ device?
In the session on StoreKit 2 (which looks amazing!), the presenter says: In fact, if your app is running when a purchase is made on another device, you'll be notified about the new transaction. This seems to mean that when an app uses the listener API to be notified of transactions, it will get transactions that happened on other devices. My app offers purchases across other platforms in addition to iOS, and when a purchase happens we register it with our own account system. If a user has the app running on both their iPad and iPhone and makes a purchase on the phone, if the iPad gets notified of it the same way it would of a purchase made on the iPad, both devices will try to report it to our system. This seems undesirable. What's the recommended approach here? Should we just make sure our system will disregard duplicate transaction reports? Or is there a way to know whether a transaction originated on this device? I don't see a property on the transaction type that looks like it could accomplish this. Maybe the deviceVerification properties? But that's seems more like the new edition of transaction receipt verification - failing that check would presumably mean that the purchase is invalid, not that it didn't happen on this device...?
Replies
2
Boosts
0
Views
3.2k
Activity
Nov ’21
User account deletion policy
Hi Apple is requiring Apps to offer an option to delete user's own account. However, account normally is tied to many different inter linked systems within an organization such as OMS, CRM, Marketing, promotion, 3rd party etc. What happens if someone inadvertently deletes an account but placed an order, or need to return an item.. Is a hard delete required or soft delete is i.e. disabling the account is acceptable to Apple. A prompt response would be greatly appreciated.
Replies
1
Boosts
0
Views
1k
Activity
Nov ’21
Cannot create any bot in Xcode 13
I can’t seem to create any bot with Xcode 13 on macOS Monterey. The error message was “The server is currently unable to build for any platforms...” The app I was trying to build was the standard macOS SwiftUI application, straight from the template code. What seems to be the problem here?
Replies
1
Boosts
0
Views
1.2k
Activity
Oct ’21
Erase all content and settings restrictions is not working in iOS 15
On applying the configuration profile(com.apple.applicationaccess - Restriction) with allowEraseContentAndSettings to false in iOS 15 device, the restriction is not imposed on supervised device. Can see restriction applied in Setting->General->VPN&Device management ->MDM profile-> Restriction. But on checking Setting->General->Reset Erase content and setting is shown. On clicking it the device has erased to factory setting. Have attached the mobileconfig and screenshots of the setting. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>PayloadContent</key> <array> <dict> <key>PayloadDescription</key> <string>Configures restrictions</string> <key>PayloadDisplayName</key> <string>Restrictions</string> <key>PayloadIdentifier</key> <string>com.apple.applicationaccess.8DA3EB9B-3C9E-45C1-99BC-B2A900E55628</string> <key>PayloadType</key> <string>com.apple.applicationaccess</string> <key>PayloadUUID</key> <string>8DA3EB9B-3C9E-45C1-99BC-B2A900E55628</string> <key>PayloadVersion</key> <integer>1</integer> <key>allowEraseContentAndSettings</key> <false/> </dict> </array> <key>PayloadDisplayName</key> <string>ContentRestriction</string> <key>PayloadIdentifier</key> <string>C7A744A3-0738-43C9-B962-DEBAABE63F4E</string> <key>PayloadRemovalDisallowed</key> <false/> <key>PayloadType</key> <string>Configuration</string> <key>PayloadUUID</key> <string>4BED8AF1-F1AC-4D2D-8B29-A130453BECB9</string> <key>PayloadVersion</key> <integer>1</integer> </dict> </plist> ![]("https://developer.apple.com/forums/content/attachment/d6e05749-559e-4428-95ad-96f304f36049" "title=IMG_0004.PNG;width=1668;height=2224") ![]("https://developer.apple.com/forums/content/attachment/3d4644b6-c074-486c-8010-1b843dc78c77" "title=IMG_0003.PNG;width=1668;height=2224") ` ![]("https://developer.apple.com/forums/content/attachment/a940b74b-3de0-4b52-b086-5e1102cb6ece" "title=IMG_0002.jpg;width=1668;height=2224") ``
Replies
3
Boosts
0
Views
2.4k
Activity
Oct ’21
AsyncImage with URLRequest?
I see in the docs that AsyncImage only takes in a URL, are there plans to expand the API to allow passing in a URLRequest, and possibly the URLSession as well? Our company's image server requires token authentication, which we pass as an HTTP header, so we're always constructing URLRequests and passing them to our custom URLSession.
Replies
2
Boosts
0
Views
1.1k
Activity
Oct ’21
Debugging on iOS 15 is terribly slow in Xcode
I'm using Xcode 12 with iPhone 12 Pro. Everything worked fine on iOS 14. But after I updated my device to iOS 15 I’m getting the app's splash screen for more than a minute every time I build the app. I've also tried to use Xcode 13 with the iOS 15 device, and it also seems to be broken!  Moreover, when I use a breakpoint and it stops I need to wait for 30-50 seconds to step over or to continue program execution. Does anyone have these problems too?
Replies
2
Boosts
0
Views
4.5k
Activity
Oct ’21
"xxx is only available in iOS 15.0 or newer"
I created a new iOS project targeting iOS 15 using Xcode 13.0 beta (13A5154h) on Big Sur to test some new SwiftUI features.  Xcode shows me the error like "xxx is only available in iOS 15.0 or newer" for all new API for iOS 15.  The project target is iOS 15  I tried to create another project again, same problem.  Would you please help to fix it?  Thanks a lot! Philipp
Replies
2
Boosts
0
Views
16k
Activity
Oct ’21
iOS 15 App Icon missing for Rich Notifications
For some reason on iOS 15 the app icon banner is missing for the expanded view on rich notifications. Toggling UNNotificationExtensionDefaultContentHidden back to false on the Content Extensions Info.plist causes the app icon to come back, but this isn't what we want since it also shows the original title & message. I've noticed that the Facebook notifications also have the same issues at the moment. I couldn't any documentation on why this changed. Attached is an example of a sample project where the App Icon is missing.
Replies
0
Boosts
0
Views
936
Activity
Oct ’21
macOS 12.0 IPSW for the Virtualization framework
Hey there! Currently, it looks like the new Virtualization.framework APIs for virtualization macOS only work with the macOS 12.0 restore image, which doesn't seem to be available. Is there a timeline/ETA on when the macOS 12.0 restore IPSW will be available? Thanks, Michael
Replies
1
Boosts
0
Views
5.1k
Activity
Oct ’21
Swift, iOS15, UIKit, CollectionView header issue
I am testing iOS15 and some new functionalities of UIKit. I've encountered some issues, not sure how to solve them. I did not change that code. This is just a piece of code that worked perfectly with the iOS 14, now after updating my target, it throws an error. Xcode crashes the moment when my custom header for the UICollectionView of type UICollectionElementKindSectionHeader is being returned for the dataSource. Here is my code: private func configureDataSource() { dataSource = UICollectionViewDiffableDataSource<Section, Follower>(collectionView: collectionView, cellProvider: { (collectionView, indexPath, followers) -> UICollectionViewCell? in let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FollowerCell.reuseId, for: indexPath) as! FollowerCell cell.set(on: followers) return cell }) dataSource.supplementaryViewProvider = { (collectionView, kind, indexPath) in let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: FollowersCollectionHeaderView.reuseId, for: indexPath) as! FollowersCollectionHeaderView header.set(with: self.user) return header } } The log says: the view returned from -collectionView:viewForSupplementaryElementOfKind:atIndexPath: does not match the element kind it is being used for. When asked for a view of element kind 'FollowersCollectionHeaderView' the data source dequeued a view registered for the element kind 'UICollectionElementKindSectionHeader'. I did cast UICollectionElementKindSectionHeader to FollowersCollectionHeaderView, therefore I am not sure what is the issue here. I've watched WWDC21 what's new in UIKit but haven't seen any mentioning of any change for that particular code. Any suggestions, what to fix in that code?
Replies
11
Boosts
0
Views
9.5k
Activity
Oct ’21