diff --git a/FilterShop/FilterShop.xcodeproj/project.pbxproj b/FilterShop/FilterShop.xcodeproj/project.pbxproj index 0e82d30..41eef31 100644 --- a/FilterShop/FilterShop.xcodeproj/project.pbxproj +++ b/FilterShop/FilterShop.xcodeproj/project.pbxproj @@ -121,7 +121,6 @@ TargetAttributes = { C8959EA31F6F377C006AC83B = { CreatedOnToolsVersion = 8.3.3; - DevelopmentTeam = L2UHX34QKF; ProvisioningStyle = Automatic; }; }; @@ -131,6 +130,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -231,6 +231,7 @@ SDKROOT = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -273,6 +274,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -281,13 +283,13 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = L2UHX34QKF; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FilterShop/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = com.xueyu.FilterShop; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -296,13 +298,13 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = L2UHX34QKF; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FilterShop/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = com.xueyu.FilterShop; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/FilterShop/FilterShop.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/FilterShop/FilterShop.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/FilterShop/FilterShop.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/FilterShop/FilterShop.xcodeproj/project.xcworkspace/xcuserdata/ruslantimchenko.xcuserdatad/UserInterfaceState.xcuserstate b/FilterShop/FilterShop.xcodeproj/project.xcworkspace/xcuserdata/ruslantimchenko.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..45625b4 Binary files /dev/null and b/FilterShop/FilterShop.xcodeproj/project.xcworkspace/xcuserdata/ruslantimchenko.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/FilterShop/FilterShop.xcodeproj/xcuserdata/ruslantimchenko.xcuserdatad/xcschemes/xcschememanagement.plist b/FilterShop/FilterShop.xcodeproj/xcuserdata/ruslantimchenko.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..c1167d9 --- /dev/null +++ b/FilterShop/FilterShop.xcodeproj/xcuserdata/ruslantimchenko.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + FilterShop.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/FilterShop/FilterShop/FilterParameterVC.swift b/FilterShop/FilterShop/FilterParameterVC.swift index 88af86d..6f021f1 100644 --- a/FilterShop/FilterShop/FilterParameterVC.swift +++ b/FilterShop/FilterShop/FilterParameterVC.swift @@ -41,15 +41,15 @@ extension FilterParameterVC : NSTableViewDelegate, NSTableViewDataSource { func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { - guard let view = tableView.make(withIdentifier: "cell", owner: self) as? NSTableCellView, + guard let view = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "cell"), owner: self) as? NSTableCellView, let key = filter?.inputKeys[row], let paraDict = filter?.attributes[key] as? [String: Any] else { return nil } - let colId = tableColumn?.identifier ?? "" + let colId = tableColumn?.identifier ?? NSUserInterfaceItemIdentifier(rawValue: "") var viewText = "" - switch colId { + switch colId.rawValue { case "name": viewText = key case "description": diff --git a/FilterShop/FilterShop/MediaDisplayView.swift b/FilterShop/FilterShop/MediaDisplayView.swift index a83274d..7a13120 100644 --- a/FilterShop/FilterShop/MediaDisplayView.swift +++ b/FilterShop/FilterShop/MediaDisplayView.swift @@ -7,6 +7,7 @@ // import Cocoa +import AppKit /// MediaDisplayView will be used to show the image /// It accepts drag and drop image @@ -47,7 +48,7 @@ class MediaDisplayView: NSView { } /// Options of the drag and drop eare, only receive images - let options = [NSPasteboardURLReadingContentsConformToTypesKey: NSImage.imageTypes()] + let options = [NSPasteboard.ReadingOptionKey.urlReadingContentsConformToTypes: NSImage.imageTypes] /// Set up ImageView and layer for filter override func draw(_ dirtyRect: NSRect) { @@ -61,12 +62,12 @@ class MediaDisplayView: NSView { NSColor.gray.setFill() - NSRectFill(dirtyRect) + dirtyRect.fill() } /// Register drag and drop, also unregister for imageView, since imageView support drag and drop naturally override func awakeFromNib() { - register(forDraggedTypes: [NSURLPboardType]) + registerForDraggedTypes([NSPasteboard.PasteboardType(kUTTypeURL as String)]) imageView.unregisterDraggedTypes() } @@ -76,7 +77,7 @@ class MediaDisplayView: NSView { func shouldAllowDrag(_ draggingInfo: NSDraggingInfo) -> Bool { var canAccept = false - let pasteBoard = draggingInfo.draggingPasteboard() + let pasteBoard = draggingInfo.draggingPasteboard if pasteBoard.canReadObject(forClasses: [ NSURL.self ], options: options) { canAccept = true @@ -107,7 +108,7 @@ class MediaDisplayView: NSView { override func performDragOperation(_ sender: NSDraggingInfo) -> Bool { isReceivingDrag = false - let pasteBoard = sender.draggingPasteboard() + let pasteBoard = sender.draggingPasteboard if let urls = pasteBoard.readObjects(forClasses: [NSURL.self], options: options) as? [URL], let fileUrl = urls.first { diff --git a/FilterShop/FilterShop/ViewController.swift b/FilterShop/FilterShop/ViewController.swift index e272225..7d240b3 100644 --- a/FilterShop/FilterShop/ViewController.swift +++ b/FilterShop/FilterShop/ViewController.swift @@ -70,9 +70,9 @@ class ViewController: NSViewController { */ @IBAction func deleteFilterTouched(_ sender: NSButton) { let idx = chosenFiltersTableView.row(for: sender) - + guard idx != -1 else { return } chosenFiltersTableView.beginUpdates() - chosenFilters.remove(at: idx) + chosenFilters.remove(at: idx == -1 ? 0 : idx) chosenFiltersTableView.removeRows(at: IndexSet(integer: idx), withAnimation: .effectFade) chosenFiltersTableView.endUpdates() @@ -115,7 +115,7 @@ class ViewController: NSViewController { guard let window = self.view.window else { return } openPanel.beginSheetModal(for: window) { (result) in - if result == NSModalResponseOK { + if result == .OK { if let url = openPanel.url { self.mediaView.imageUrl = url } @@ -131,7 +131,7 @@ class ViewController: NSViewController { // Help Menu Item @IBAction func helpMenuItemTouched(_ sender: NSMenuItem) { let url = URL(string: "https://github.com/KrisYu/FilterShop")! - NSWorkspace.shared().open(url) + NSWorkspace.shared.open(url) } @@ -140,19 +140,19 @@ class ViewController: NSViewController { */ @IBAction func saveAs(_ sender: AnyObject){ let savePanel = NSSavePanel() - saveOptions = IKSaveOptions(imageProperties: [:], imageUTType: kUTTypePNG as String!) + saveOptions = IKSaveOptions(imageProperties: [:], imageUTType: kUTTypePNG as String) saveOptions.addAccessoryView(to: savePanel) guard let window = self.view.window, let _ = mediaView.ciimage else { return } savePanel.beginSheetModal(for: window) { (result) in - if result == NSFileHandlingPanelOKButton { - self.savePanelDidEnd(sheet: savePanel, returnCode: result) + if result == .OK { + self.savePanelDidEnd(sheet: savePanel, returnCode: result.rawValue) } } } func savePanelDidEnd (sheet: NSSavePanel, returnCode: NSInteger) { - if returnCode == NSModalResponseOK { + if returnCode == NSApplication.ModalResponse.OK.rawValue { guard let newUTType = saveOptions.imageUTType as CFString?, let url = sheet.url as CFURL?, let cgimage = mediaView.export(filters: chosenFilters), @@ -189,7 +189,7 @@ extension ViewController: NSTableViewDelegate, NSTableViewDataSource { // cell display Category and Filter in a different way if filterName.hasPrefix("CICategory") { - guard let cell = tableView.make(withIdentifier: "CategoryCell", owner: self) as? NSTableCellView else { + guard let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "CategoryCell"), owner: self) as? NSTableCellView else { return nil } @@ -197,7 +197,7 @@ extension ViewController: NSTableViewDelegate, NSTableViewDataSource { cell.textField?.stringValue = text return cell } else { - guard let cell = tableView.make(withIdentifier: "FilterCell", owner: self) as? NSTableCellView, + guard let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "FilterCell"), owner: self) as? NSTableCellView, let text = CIFilter.localizedName(forFilterName: filterName) else { return nil } @@ -208,7 +208,7 @@ extension ViewController: NSTableViewDelegate, NSTableViewDataSource { let filterName = chosenFilters[row].name - guard let cell = tableView.make(withIdentifier: "chosenFilterCell", owner: self) as? NSTableCellView else { return nil } + guard let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "chosenFilterCell"), owner: self) as? NSTableCellView else { return nil } // display the filter name in readable way cell.textField?.stringValue = CIFilter.localizedName(forFilterName: filterName) ?? "Unknown Filter"