Skip to content

Commit

Permalink
Merge pull request #24 from gewill/master
Browse files Browse the repository at this point in the history
Migration to Swift 5.0 with Xcode 10.2.1
  • Loading branch information
kyleduo authored Apr 20, 2019
2 parents c3a105e + fa1c2fa commit 0b1e01b
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 52 deletions.
4 changes: 2 additions & 2 deletions source/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ inhibit_all_warnings!

target 'TinyPNG4Mac' do

pod 'Alamofire', '~> 4.0'
pod 'SwiftyJSON'
pod 'Alamofire', '~> 4.8.2'
pod 'SwiftyJSON', '~> 5.0'

end

Expand Down
21 changes: 13 additions & 8 deletions source/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
PODS:
- Alamofire (4.4.0)
- SwiftyJSON (3.1.4)
- Alamofire (4.8.2)
- SwiftyJSON (5.0.0)

DEPENDENCIES:
- Alamofire (~> 4.0)
- SwiftyJSON
- Alamofire (~> 4.8.2)
- SwiftyJSON (~> 5.0)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Alamofire
- SwiftyJSON

SPEC CHECKSUMS:
Alamofire: dc44b1600b800eb63da6a19039a0083d62a6a62d
SwiftyJSON: c2842d878f95482ffceec5709abc3d05680c0220
Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7

PODFILE CHECKSUM: 52e07e7158f2fa7bd16153c6015742d83879ff4e
PODFILE CHECKSUM: 1e14da6108c97041b7daef307aaa48a8f180f7a4

COCOAPODS: 1.4.0
COCOAPODS: 1.6.1
29 changes: 6 additions & 23 deletions source/tinypng4mac.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
277AAF4C1D23F24900788F37 /* Frameworks */,
277AAF4D1D23F24900788F37 /* Resources */,
5B420B6B1C8EFF2B07BE8D63 /* [CP] Embed Pods Frameworks */,
C444391B23F5566C92F691F0 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -213,7 +212,7 @@
TargetAttributes = {
277AAF4E1D23F24900788F37 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0920;
LastSwiftMigration = 1020;
};
};
};
Expand All @@ -222,6 +221,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
"zh-Hans",
Expand Down Expand Up @@ -275,7 +275,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-TinyPNG4Mac/Pods-TinyPNG4Mac-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-TinyPNG4Mac/Pods-TinyPNG4Mac-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework",
);
Expand All @@ -286,22 +286,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TinyPNG4Mac/Pods-TinyPNG4Mac-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C444391B23F5566C92F691F0 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TinyPNG4Mac/Pods-TinyPNG4Mac-resources.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TinyPNG4Mac/Pods-TinyPNG4Mac-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -455,8 +440,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.kyleduo.tinypngmac;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -471,8 +455,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.kyleduo.tinypngmac;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
20 changes: 10 additions & 10 deletions source/tinypng4mac/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -138,7 +138,7 @@
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" customClass="MainWindowController" customModule="TinyPNG4Mac" customModuleProvider="target" sceneMemberID="viewController">
<window key="window" title="TinyPNG - Mac Client" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA" customClass="TPWindow" customModule="TinyPNG4Mac" customModuleProvider="target">
<window key="window" title="TinyPNG - Mac Client" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA" customClass="TPWindow" customModule="TinyPNG4Mac" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" fullSizeContentView="YES"/>
<rect key="contentRect" x="541" y="360" width="320" height="320"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
Expand Down Expand Up @@ -195,7 +195,7 @@
<rect key="frame" x="132" y="39" width="146" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="99a-9k-u4D">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
Expand All @@ -216,7 +216,7 @@
<rect key="frame" x="132" y="65" width="172" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="OCF-de-u9Q">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
Expand Down Expand Up @@ -341,7 +341,7 @@
<color key="backgroundColor" white="1" alpha="0.0" colorSpace="deviceWhite"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="" width="317" minWidth="40" maxWidth="1000" id="5uH-R6-sDa">
<tableColumn width="317" minWidth="40" maxWidth="1000" id="5uH-R6-sDa">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -437,7 +437,7 @@
</scroller>
</scrollView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fcw-HM-Ub9">
<rect key="frame" x="106" y="396" width="107" height="17"/>
<rect key="frame" x="107" y="396" width="107" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="TinyPNG for Mac" id="8Ac-Uq-uCZ">
<font key="font" metaFont="system"/>
<color key="textColor" name="highlightColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -498,9 +498,9 @@
</scene>
</scenes>
<resources>
<image name="icon" width="240" height="240"/>
<image name="icon_finder" width="64" height="64"/>
<image name="icon" width="120" height="120"/>
<image name="icon_finder" width="32" height="32"/>
<image name="icon_finish" width="16" height="16"/>
<image name="icon_setting" width="64" height="64"/>
<image name="icon_setting" width="32" height="32"/>
</resources>
</document>
2 changes: 1 addition & 1 deletion source/tinypng4mac/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class MainViewController: NSViewController, NSOpenSavePanelDelegate, NSTableView

// MARK: - textfield

override func controlTextDidEndEditing(_ obj: Notification) {
func controlTextDidEndEditing(_ obj: Notification) {
if let textField = obj.object as? NSTextField {
if !textField.isEditable {
return;
Expand Down
4 changes: 2 additions & 2 deletions source/tinypng4mac/tpclient/TPStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ class TPStore {
if self.tasks.count == 0 {
return nil;
}
let index = self.tasks.index(where: {$0.uuid == task.uuid})
let index = self.tasks.firstIndex(where: {$0.uuid == task.uuid})
if let i = index {
return self.tasks.remove(at: i)
}
return nil;
}

func indexOf(_ task: TPTaskInfo) -> Int {
if let i = self.tasks.index(where: {$0.uuid == task.uuid}) {
if let i = self.tasks.firstIndex(where: {$0.uuid == task.uuid}) {
return i
}
return -1
Expand Down
4 changes: 2 additions & 2 deletions source/tinypng4mac/views/DragContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DragContainer: NSView {

override func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
var files = Array<URL>()
if let board = sender.draggingPasteboard().propertyList(forType: NSFilenamesPboardType) as? NSArray {
if let board = sender.draggingPasteboard.propertyList(forType: NSFilenamesPboardType) as? NSArray {
for path in board {
let url = URL(fileURLWithPath: path as! String)
let fileExtension = url.pathExtension.lowercased()
Expand All @@ -80,7 +80,7 @@ class DragContainer: NSView {
}

func checkExtension(_ draggingInfo: NSDraggingInfo) -> Bool {
if let board = draggingInfo.draggingPasteboard().propertyList(forType: NSFilenamesPboardType) as? NSArray {
if let board = draggingInfo.draggingPasteboard.propertyList(forType: NSFilenamesPboardType) as? NSArray {
for path in board {
let url = URL(fileURLWithPath: path as! String)
let fileExtension = url.pathExtension.lowercased()
Expand Down
8 changes: 4 additions & 4 deletions source/tinypng4mac/views/InputKeyAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class InputKeyAlert: NSAlert, NSTextFieldDelegate {
let paragraphStyle = NSMutableParagraphStyle.init()
paragraphStyle.alignment = NSTextAlignment.center
let title = NSMutableAttributedString.init(string: NSLocalizedString("Register", comment: "Register"))
title.addAttributes([NSAttributedStringKey.foregroundColor: NSColor.blue,
NSAttributedStringKey.paragraphStyle:paragraphStyle,
NSAttributedStringKey.underlineStyle:NSUnderlineStyle.styleSingle.rawValue], range: NSMakeRange(0, title.length))
title.addAttributes([NSAttributedString.Key.foregroundColor: NSColor.blue,
NSAttributedString.Key.paragraphStyle:paragraphStyle,
NSAttributedString.Key.underlineStyle:NSUnderlineStyle.single.rawValue], range: NSMakeRange(0, title.length))
button.attributedTitle = title
button.target = self
button.action = #selector(InputKeyAlert.gotoRegister)
Expand All @@ -61,7 +61,7 @@ class InputKeyAlert: NSAlert, NSTextFieldDelegate {
})
}

override func controlTextDidChange(_ obj: Notification) {
func controlTextDidEndEditing(_ obj: Notification) {
if let text = input?.stringValue {
self.submitButton?.isEnabled = text.count > 0
}
Expand Down

0 comments on commit 0b1e01b

Please sign in to comment.