Post

Replies

Boosts

Views

Activity

Apple store genre/genre ID enums
I'm working on a media metadata tagging library, and the only source I can find for a list of the pre-defined genres in use with iTunes/Quicktime is on the ExifTool website for QuickTime GenreID and I have no way of knowing how current it is. If possible, I would rather use whatever enum Apple already provides for this, if it's available, but I haven't been able to find it. Can anyone point me in the right direction?
0
0
483
Oct ’20
working with fileImporter in a list
I'm running into an issue trying to create a link to fileImporter as part of a list of options. I have an enum of options that will be presented in a sidebar-style list menu: enum MenuOption: Identifiable, CaseIterable { var id: Int { self.hashValue } case import case optionB case optionC case optionD case optionE @ViewBuilder var destination: some View { switch self { case .import: ImportView(isPresented: .constant(true), progress: ImportProgress()) case .optionB: OptionBView() // etc } } And I am iterating over the enum as follows: struct SidebarMenuView: View { @State private var selection : MenuOption? = nil var body: some View { List(selection: $selection) { ForEach(MenuOption.allCases) { option in Button(action: { self.selection = option} ) { option.label } .sheet(item: $selection) { sheet in sheet.destination } } } } } However, presenting fileImporter as its own view causes the interface to crash. It has to be attached to something as a view modifier. The workaround suggested on SO is to attach it to Color.clear: struct ImportView: View { @Binding var isPresented: Bool @ObservedObject var progress: ImportProgress var body: some View { Color.clear .fileImporter( isPresented: $isPresented, allowedContentTypes: [ ... ], allowsMultipleSelection: true) { result in if let urls = try? result.get() { do { // stuff } } } } But the result of is this that, after fileImporter has been dismissed, there's an empty sheet still displayed which has to be dismissed separately, and I can't find a way around that.
2
0
1.5k
Feb ’21