Fix crash when selecting a export filetype on macOS 12
This commit is contained in:
parent
dacb12aad8
commit
d34db5e2ea
1 changed files with 7 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import AppKit
|
import AppKit
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
|
||||||
class ExportAccessoryView : NSView {
|
class ExportAccessoryView : NSView {
|
||||||
|
|
||||||
|
@ -18,7 +19,11 @@ class ExportAccessoryView : NSView {
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func changeFileFormat(_ sender: Any) {
|
@IBAction func changeFileFormat(_ sender: Any) {
|
||||||
|
if #available(macOS 11.0, *) {
|
||||||
|
savePanel?.allowedContentTypes = [UTType(filenameExtension: (typeBox.titleOfSelectedItem?.lowercased())!)!]
|
||||||
|
} else {
|
||||||
savePanel?.allowedFileTypes?.removeAll()
|
savePanel?.allowedFileTypes?.removeAll()
|
||||||
savePanel?.allowedFileTypes?.append((typeBox.titleOfSelectedItem?.lowercased())!)
|
savePanel?.allowedFileTypes?.append((typeBox.titleOfSelectedItem?.lowercased())!)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue