Skip to content

Commit

Permalink
Upgrade to Swift 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 16, 2020
1 parent 84cdafd commit 29cab37
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 117 deletions.
1 change: 0 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ whitelist_rules:
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- untyped_error_in_catch
- unused_capture_list
- unused_closure_parameter
- unused_control_flow_label
- unused_enumerated
Expand Down
8 changes: 5 additions & 3 deletions Gifski.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 53;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -324,7 +324,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1100;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = "Sindre Sorhus";
TargetAttributes = {
0E79251A2329BDBE00058B94 = {
Expand All @@ -345,7 +345,7 @@
};
};
buildConfigurationList = E3AE627E1E5CD2F300035A2F /* Build configuration list for PBXProject "Gifski" */;
compatibilityVersion = "Xcode 11.4";
compatibilityVersion = "Xcode 12.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down Expand Up @@ -614,6 +614,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -674,6 +675,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down
2 changes: 1 addition & 1 deletion Gifski.xcodeproj/xcshareddata/xcschemes/Gifski.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
32 changes: 16 additions & 16 deletions Gifski/Assets.xcassets/ButtonTextColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "mac",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0xFF",
"alpha" : "1.000",
"blue" : "0xFF",
"green" : "0xFF"
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
}
},
"idiom" : "universal"
},
{
"idiom" : "mac",
"appearances" : [
{
"appearance" : "luminosity",
Expand All @@ -27,12 +22,17 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0x00",
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00"
"blue" : "0.000",
"green" : "0.000",
"red" : "0.000"
}
}
},
"idiom" : "universal"
}
]
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
20 changes: 10 additions & 10 deletions Gifski/Assets.xcassets/ProgressCircleColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "mac",
"color" : {
"platform" : "osx",
"reference" : "controlAccentColor"
}
},
"idiom" : "universal"
},
{
"idiom" : "mac",
"appearances" : [
{
"appearance" : "luminosity",
Expand All @@ -22,7 +17,12 @@
"color" : {
"platform" : "osx",
"reference" : "labelColor"
}
},
"idiom" : "universal"
}
]
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
46 changes: 14 additions & 32 deletions Gifski/Assets.xcassets/ShadowColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,18 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.000",
"alpha" : "0.500",
"blue" : "0.000",
"green" : "0.000"
"green" : "0.000",
"red" : "0.000"
}
}
},
"idiom" : "universal"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.000",
"alpha" : "0.500",
"blue" : "0.000",
"green" : "0.000"
}
}
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
Expand All @@ -45,12 +22,17 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.000",
"alpha" : "0.800",
"blue" : "0.000",
"green" : "0.000"
"green" : "0.000",
"red" : "0.000"
}
}
},
"idiom" : "universal"
}
]
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
8 changes: 4 additions & 4 deletions Gifski/ConversionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ final class ConversionViewController: NSViewController {
timeRemainingEstimator.start()

progress?.performAsCurrent(withPendingUnitCount: 1) { [weak self] in
gifski.run(conversion) { result in
guard let self = self else {
return
}
guard let self = self else {
return
}

gifski.run(conversion) { result in
do {
let gifUrl = try self.generateTemporaryGifUrl(for: conversion.video)
try result.get().write(to: gifUrl, options: .atomic)
Expand Down
6 changes: 3 additions & 3 deletions Gifski/DraggableFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class DraggableFile: NSImageView {
var fileUrl: URL? {
didSet {
guard
let fileUrl = self.fileUrl,
let fileUrl = fileUrl,
let image = NSImage(contentsOf: fileUrl)
else {
return
Expand Down Expand Up @@ -51,8 +51,8 @@ final class DraggableFile: NSImageView {

override func mouseDragged(with event: NSEvent) {
guard
let fileUrl = self.fileUrl,
let image = self.image
let fileUrl = fileUrl,
let image = image
else {
return
}
Expand Down
10 changes: 5 additions & 5 deletions Gifski/EditVideoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,11 @@ final class EditVideoViewController: NSViewController {

private func estimateFileSize() {
let duration: Double = {
if let timeRange = self.timeRange {
return timeRange.upperBound - timeRange.lowerBound
} else {
guard let timeRange = timeRange else {
return videoMetadata.duration
}

return timeRange.upperBound - timeRange.lowerBound
}()

let frameCount = duration * frameRateSlider.doubleValue
Expand Down Expand Up @@ -376,8 +376,8 @@ final class EditVideoViewController: NSViewController {

private func updateSelectedItemAsCustomWithSize() {
let newType: DimensionsType = resizableDimensions.currentDimensions.type == .percent ? .pixels : .percent
let resizableDimensions = self.resizableDimensions.changed(dimensionsType: newType)
let selectedCustomTitle = "Custom - \(resizableDimensions.currentDimensions)"
let newResizableDimensions = resizableDimensions.changed(dimensionsType: newType)
let selectedCustomTitle = "Custom - \(newResizableDimensions.currentDimensions)"
predefinedSizesDropdown.item(at: 0)?.title = selectedCustomTitle
predefinedSizesDropdown.selectItem(at: 0)
}
Expand Down
4 changes: 2 additions & 2 deletions Gifski/MainWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ final class MainWindowController: NSWindowController {
window?.contentViewController is ConversionViewController
}

private func showWelcomeScreen() {
private func showWelcomeScreenIfNeeded() {
guard App.isFirstLaunch else {
return
}
Expand Down Expand Up @@ -63,7 +63,7 @@ final class MainWindowController: NSWindowController {
NSApp.activate(ignoringOtherApps: false)
window.makeKeyAndOrderFront(nil)

showWelcomeScreen()
showWelcomeScreenIfNeeded()
}

func presentOpenPanel() {
Expand Down
16 changes: 8 additions & 8 deletions Gifski/TimeRemainingEstimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,24 @@ final class TimeRemainingEstimator {
}

private func fadeInLabel() {
DispatchQueue.main.async {
if self.label.isHidden {
self.label.fadeIn()
DispatchQueue.main.async { [self] in
if label.isHidden {
label.fadeIn()
}
}
}

private func fadeOutLabel() {
DispatchQueue.main.async {
if !self.label.isHidden {
self.label.fadeOut()
DispatchQueue.main.async { [self] in
if !label.isHidden {
label.fadeOut()
}
}
}

private func updateLabel() {
DispatchQueue.main.async {
self.label.text = self.formattedTimeRemaining ?? ""
DispatchQueue.main.async { [self] in
label.text = formattedTimeRemaining ?? ""
}
}
}

0 comments on commit 29cab37

Please sign in to comment.