Add keyboard utilities to RSCore.
This commit is contained in:
parent
dd89f2dea7
commit
705efcb7e8
|
@ -72,6 +72,7 @@
|
|||
8432B1861DACA0E90057D6DF /* NSResponder-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8432B1851DACA0E90057D6DF /* NSResponder-Extensions.swift */; };
|
||||
8432B1881DACA2060057D6DF /* NSWindow-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8432B1871DACA2060057D6DF /* NSWindow-Extensions.swift */; };
|
||||
84411E731FE5FFC3004B527F /* NSImage+RSCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84411E721FE5FFC3004B527F /* NSImage+RSCore.swift */; };
|
||||
844B5B571FE9D36000C7C76A /* Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844B5B561FE9D36000C7C76A /* Keyboard.swift */; };
|
||||
844C915B1B65753E0051FC1B /* RSPlist.h in Headers */ = {isa = PBXBuildFile; fileRef = 844C91591B65753E0051FC1B /* RSPlist.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
844C915C1B65753E0051FC1B /* RSPlist.m in Sources */ = {isa = PBXBuildFile; fileRef = 844C915A1B65753E0051FC1B /* RSPlist.m */; };
|
||||
844F91D51D90D86100820C48 /* RSTransparentContainerView.h in Headers */ = {isa = PBXBuildFile; fileRef = 844F91D31D90D86100820C48 /* RSTransparentContainerView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
|
@ -191,6 +192,7 @@
|
|||
8432B1851DACA0E90057D6DF /* NSResponder-Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSResponder-Extensions.swift"; sourceTree = "<group>"; };
|
||||
8432B1871DACA2060057D6DF /* NSWindow-Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSWindow-Extensions.swift"; sourceTree = "<group>"; };
|
||||
84411E721FE5FFC3004B527F /* NSImage+RSCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "NSImage+RSCore.swift"; path = "Images/NSImage+RSCore.swift"; sourceTree = "<group>"; };
|
||||
844B5B561FE9D36000C7C76A /* Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Keyboard.swift; path = RSCore/Keyboard.swift; sourceTree = "<group>"; };
|
||||
844C91591B65753E0051FC1B /* RSPlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RSPlist.h; path = RSCore/RSPlist.h; sourceTree = "<group>"; };
|
||||
844C915A1B65753E0051FC1B /* RSPlist.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RSPlist.m; path = RSCore/RSPlist.m; sourceTree = "<group>"; };
|
||||
844F91D31D90D86100820C48 /* RSTransparentContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RSTransparentContainerView.h; sourceTree = "<group>"; };
|
||||
|
@ -348,6 +350,7 @@
|
|||
84E34DA51F9FA1070077082F /* UndoableCommand.swift */,
|
||||
8402047D1FBCE77900D94C1A /* BatchUpdate.swift */,
|
||||
848F6AE81FC2BC50002D422E /* ThreadSafeCache.swift */,
|
||||
844B5B561FE9D36000C7C76A /* Keyboard.swift */,
|
||||
84CFF5241AC3C8A200CEA6C8 /* Foundation */,
|
||||
84CFF5551AC3CF4A00CEA6C8 /* AppKit */,
|
||||
84E72E0F1FBD647500B873C1 /* Inspector */,
|
||||
|
@ -771,6 +774,7 @@
|
|||
84CFF56A1AC3D1B000CEA6C8 /* RSScaling.m in Sources */,
|
||||
84FEB4AC1D19D7F4004727E5 /* Date+Extensions.swift in Sources */,
|
||||
8479213E1FBA4285004AD08C /* WebViewWindowController.swift in Sources */,
|
||||
844B5B571FE9D36000C7C76A /* Keyboard.swift in Sources */,
|
||||
8461387F1DB3F5BE00048B83 /* RSToolbarItem.swift in Sources */,
|
||||
84B99C941FAE64D500ECDEDB /* DisplayNameProvider.swift in Sources */,
|
||||
84BB45431D6909C700B48537 /* NSMutableDictionary-Extensions.swift in Sources */,
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// Keyboard.swift
|
||||
// RSCore
|
||||
//
|
||||
// Created by Brent Simmons on 12/19/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// To get, for instance, the keyboard integer value for "\r": "\r".keyboardIntegerValue (returns 13)
|
||||
|
||||
public struct KeyboardConstant {
|
||||
|
||||
public static let lineFeedKey = "\n".keyboardIntegerValue
|
||||
public static let returnKey = "\r".keyboardIntegerValue
|
||||
}
|
||||
|
||||
public extension String {
|
||||
|
||||
public var keyboardIntegerValue: Int {
|
||||
return Int(utf8[utf8.startIndex])
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue