When using either UICollectionViewDiffableDataSource or UITableViewDiffableDataSource, what is the "correct/safe" way to get the section identifier from an index path?snapshot().sectionIdentifiers[indexPath.section]orguard let item = itemIdentifier(for: indexPath) else { return }
snapshot().sectionIdentifier(containingItem: item)?
Post
Replies
Boosts
Views
Activity
(Cross post from: Stack Overflow - https://stackoverflow.com/questions/64096402/swiftui-preview-sheet-w-o-running-live-preview)
Is it possible to create a SwiftUI preview of a presented sheet without running the Live Preview? For example:
struct Sheet_Previews: PreviewProvider {
static var previews: some View {
Text("Background").sheet(isPresented: .constant(true)) {
Text("Sheet")
}
}
}
The above results in the following preview:
(See image 1 on Stack Overflow - https://stackoverflow.com/questions/64096402/swiftui-preview-sheet-w-o-running-live-preview)
In order for the sheet content to be presented in the preview, you must run the Live Preview:
(See image 2 on Stack Overflow - https://stackoverflow.com/questions/64096402/swiftui-preview-sheet-w-o-running-live-preview)
In the Stringsdict File Format appendix of the Internationalization Guide - https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/StringsdictFileFormat/StringsdictFileFormat.html#//apple_ref/doc/uid/10000171i-CH16-SW1 it states:
Avoid using a .stringsdict file with a string that does not include a number, because a language might define generic singular and plural forms in ways that don’t work well with the one and other categories. By “does not include a number”, does that mean if a digit is not present in the string it shouldn’t be added to the .stringsdict?
For example: would a string like “Where is your dog?” be a bad candidate because it doesn’t contain a number even though it could be pluralized to “Where are your dogs?“ If so, what is the correct way to localize that example string?