@@ -12,8 +12,8 @@ import SystemExtensions
1212#error("SystemExtensionKit doesn't support Swift versions below 5.5.")
1313#endif
1414
15- /// Current SystemExtensionKit version 1.1.2 . Necessary since SPM doesn't use dynamic libraries. Plus this will be more accurate.
16- public let version = " 1.1.2 "
15+ /// Current SystemExtensionKit version 1.1.3 . Necessary since SPM doesn't use dynamic libraries. Plus this will be more accurate.
16+ public let version = " 1.1.3 "
1717
1818public let SystemExtension = SystemExtensionKit . shared
1919
@@ -22,15 +22,15 @@ public protocol SystemExtensionDelegate: NSObjectProtocol {
2222}
2323
2424public class SystemExtensionKit : NSObject {
25- public enum ExtensionError : LocalizedError {
25+ public enum ExtensionError : Error {
2626 case extensionDirectoryFailed( String , Error )
2727 case extensionNotExist
2828 case extensionCreateURLFailed( String )
2929 case extensionBundleIdMissing( String )
3030 case extensionRequestFailed( Error )
3131 case extensionNeedReboot
3232
33- var localizedDescription : String ? {
33+ var localizedDescription : String {
3434 switch self {
3535 case . extensionDirectoryFailed( let urlStr, let error) :
3636 return " Failed to get the contents of \( urlStr) : \( error. localizedDescription) "
@@ -41,9 +41,9 @@ public class SystemExtensionKit: NSObject {
4141 case . extensionBundleIdMissing( let urlStr) :
4242 return " Failed to get bundleIdentifier of system extensions bundle with URL: \( urlStr) "
4343 case . extensionRequestFailed( let error) :
44- return " Failed to request authorization : \( error. localizedDescription) "
44+ return " Failed to request extension : \( error. localizedDescription) "
4545 case . extensionNeedReboot:
46- return " Failed to request authorization : user need to reboot mac "
46+ return " Failed to request extension : user need to reboot mac "
4747 }
4848 }
4949 }
@@ -219,3 +219,14 @@ public extension SystemExtensionKit {
219219 return extensionBundle
220220 }
221221}
222+
223+ // MARK: - Error Convinience
224+
225+ public extension Error {
226+ var systemExtensionDescription : String {
227+ guard let error = self as? SystemExtensionKit . ExtensionError else {
228+ return localizedDescription
229+ }
230+ return error. localizedDescription
231+ }
232+ }
0 commit comments