Skip to content

Commit

Permalink
UTGetOSTypeFromStringがDeprecatedだったのでOSTypeで取得できるように修正した
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyome22 committed Feb 28, 2024
1 parent 2b075c5 commit f32fc5b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Demo/SpiceKeyDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1340;
LastUpgradeCheck = 1500;
LastUpgradeCheck = 1520;
TargetAttributes = {
1CC92D4D286B5E9900D46424 = {
CreatedOnToolsVersion = 13.4.1;
Expand Down Expand Up @@ -262,6 +262,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -311,7 +312,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand All @@ -325,6 +326,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -368,7 +370,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<key>SpiceKeyDemo_AppKit.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
<key>SpiceKeyDemo_SwiftUI.xcscheme_^#shared#^_</key>
<dict>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
NSEvent.ModifierFlags+Extensions.swift
NSEvent.ModifierFlags+Extension.swift
SpiceKey

Created by Takuto Nakamura on 2021/08/01.
Expand Down
2 changes: 1 addition & 1 deletion Sources/SpiceKey/SpiceKeyManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class SpiceKeyManager {
public static let shared = SpiceKeyManager()
internal var spiceKeys = [SpiceKeyID : SpiceKey]()
private var hotKeyEventHandlerRef: EventHandlerRef? = nil
private let signature = UTGetOSTypeFromString("SpiceKey" as CFString)
private let signature = OSType("SpiceKey")
private var monitors = [Any?]()
private var notifyCancellable: AnyCancellable?
private var invoked: Bool = false
Expand Down
18 changes: 18 additions & 0 deletions Sources/SpiceKey/String+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
String+Extension.swift


Created by Takuto Nakamura on 2024/02/29.
*/

import Foundation

extension OSType: ExpressibleByStringLiteral {
public init(stringLiteral: StringLiteralType) {
if let data = stringLiteral.data(using: .macOSRoman) {
self.init(data.reduce(0, { ($0 << 8) + Self($1) }))
} else {
self.init(0)
}
}
}

0 comments on commit f32fc5b

Please sign in to comment.