First try on uploading apkg files
Not working because defining a custom extension is kicking my ass:/
This commit is contained in:
50
WordAX/Info.plist
Normal file
50
WordAX/Info.plist
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>icon</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>APKG File</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Default</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.wordax.apkg</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Default</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>APKG Data</string>
|
||||
<key>UTTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.wordax.apkg</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>apkg</string>
|
||||
<string>APKG</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AddFlashCard: View {
|
||||
struct AddFlashCardView: View {
|
||||
@State var text: String = ""
|
||||
@State var description: String = ""
|
||||
@Binding var isShowing: Bool
|
||||
@@ -64,6 +64,6 @@ struct AddFlashCard: View {
|
||||
|
||||
#Preview {
|
||||
@State var isShowing = true
|
||||
return AddFlashCard(isShowing: $isShowing)
|
||||
return AddFlashCardView(isShowing: $isShowing)
|
||||
.environment(\.managedObjectContext, DataController.preview.container.viewContext)
|
||||
}
|
||||
@@ -54,7 +54,7 @@ struct FlashCardListView: View {
|
||||
Text("Select word to get details about")
|
||||
}
|
||||
.sheet(isPresented: $addFlashcard, content: {
|
||||
AddFlashCard(isShowing: $addFlashcard)
|
||||
AddFlashCardView(isShowing: $addFlashcard)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,41 @@
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
struct SettingsView: View {
|
||||
@State var isImporting: Bool = false
|
||||
var body: some View {
|
||||
Text("This is settings")
|
||||
Group {
|
||||
// List {
|
||||
Button(action: {
|
||||
// open file explorer
|
||||
isImporting.toggle()
|
||||
}, label: {
|
||||
Text("CLICK ME PLSSS")
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(.yellow)
|
||||
.clipShape(.buttonBorder)
|
||||
})
|
||||
}
|
||||
.fileImporter(isPresented: $isImporting, allowedContentTypes: [.apkg]) { result in
|
||||
switch result {
|
||||
case .success(let text):
|
||||
print(text)
|
||||
case .failure(let error):
|
||||
print(error)
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
extension UTType {
|
||||
public static let apkg: UTType = UTType(exportedAs: "com.wordax.apkg")
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SettingsView()
|
||||
.environmentObject(WordAXModelView())
|
||||
|
||||
Reference in New Issue
Block a user