I want be able to select Xcode projects in my native macOS app, I am using .xcodeproj for allowedContentTypes, but clearly Xcode or UniformTypeIdentifiers does not know about it! Is there a way around to make the codes works?
import SwiftUI
import UniformTypeIdentifiers
struct ContentView: View {
@State private var fileImporterIsPresented: Bool = false
var body: some View {
Button("Select your Xcode projext") { fileImporterIsPresented = true }
.fileImporter(isPresented: $fileImporterIsPresented, allowedContentTypes: [.xcodeproj], allowsMultipleSelection: false, onCompletion: { result in
switch result {
case .success(let urls):
if let unwrappedURL: URL = urls.first {
print(unwrappedURL.path)
}
case .failure(let error):
print("Error selecting file \(error.localizedDescription)")
}
})
}
}