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 d97e5e9 commit 59f2f47
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion KeyboardShortcuts.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |s|
s.authors = { 'Sindre Sorhus' => '[email protected]' }
s.source = { :git => 'https://github.com/sindresorhus/KeyboardShortcuts.git', :tag => "v#{s.version}" }
s.source_files = 'Sources/**/*.swift'
s.swift_version = '5.2'
s.swift_version = '5.3'
s.platform = :macos, '10.11'
s.weak_framework = 'Combine'
end
16 changes: 9 additions & 7 deletions KeyboardShortcuts.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 @@ -270,7 +270,7 @@
attributes = {
LastSwiftMigration = 9999;
LastSwiftUpdateCheck = 1160;
LastUpgradeCheck = 1150;
LastUpgradeCheck = 1200;
TargetAttributes = {
E3500C3224DEDCEF00F4B055 = {
CreatedOnToolsVersion = 11.6;
Expand All @@ -281,7 +281,7 @@
};
};
buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "KeyboardShortcuts" */;
compatibilityVersion = "Xcode 11.4";
compatibilityVersion = "Xcode 12.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down Expand Up @@ -661,7 +661,7 @@
);
HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = KeyboardShortcuts.xcodeproj/KeyboardShortcuts_Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
Expand All @@ -678,7 +678,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
SWIFT_VERSION = 5.0;
TARGET_NAME = KeyboardShortcuts;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 12.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
name = Debug;
Expand All @@ -696,7 +696,7 @@
);
HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = KeyboardShortcuts.xcodeproj/KeyboardShortcuts_Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
Expand All @@ -713,7 +713,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
SWIFT_VERSION = 5.0;
TARGET_NAME = KeyboardShortcuts;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 12.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
name = Release;
Expand Down Expand Up @@ -752,6 +752,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
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 @@ -809,6 +810,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1160"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 4 additions & 4 deletions KeyboardShortcutsExample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ struct ContentView: View {
.padding(60)
.onAppear {
KeyboardShortcuts.onKeyDown(for: .testShortcut1) {
self.isPressed1 = true
isPressed1 = true
}

KeyboardShortcuts.onKeyUp(for: .testShortcut1) {
self.isPressed1 = false
isPressed1 = false
}

KeyboardShortcuts.onKeyDown(for: .testShortcut2) {
self.isPressed2 = true
isPressed2 = true
}

KeyboardShortcuts.onKeyUp(for: .testShortcut2) {
self.isPressed2 = false
isPressed2 = false
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.3
import PackageDescription

let package = Package(
Expand Down
8 changes: 4 additions & 4 deletions Sources/KeyboardShortcuts/KeyboardShortcuts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ public enum KeyboardShortcuts {
@NSApplicationMain
final class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
KeyboardShortcuts.onKeyDown(for: .toggleUnicornMode) {
self.isUnicornMode.toggle()
KeyboardShortcuts.onKeyDown(for: .toggleUnicornMode) { [self] in
isUnicornMode.toggle()
}
}
}
Expand Down Expand Up @@ -251,8 +251,8 @@ public enum KeyboardShortcuts {
@NSApplicationMain
final class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
KeyboardShortcuts.onKeyUp(for: .toggleUnicornMode) {
self.isUnicornMode.toggle()
KeyboardShortcuts.onKeyUp(for: .toggleUnicornMode) { [self] in
isUnicornMode.toggle()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/KeyboardShortcuts/Shortcut.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ extension KeyboardShortcuts.Shortcut {

guard keyString.count <= 1 else {
guard
let key = self.key,
let key = key,
let string = keyToKeyEquivalentString[key]
else {
return ""
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ import KeyboardShortcuts
@NSApplicationMain
final class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
KeyboardShortcuts.onKeyUp(for: .toggleUnicornMode) {
KeyboardShortcuts.onKeyUp(for: .toggleUnicornMode) { [self] in
// The user pressed the keyboard shortcut for “unicorn mode”!
self.isUnicornMode.toggle()
isUnicornMode.toggle()
}
}
}
Expand Down

0 comments on commit 59f2f47

Please sign in to comment.