### Perform Thread-Safe File I/O with SKDispatchFile Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Utilizes DispatchIO to perform asynchronous, thread-safe file reading and writing. Includes examples for setting quality of service and custom file permissions. ```swift import SystemKit let dispatchFile = SKDispatchFile(qualityOfService: .background) dispatchFile.read(filePath: "/Users/user/Desktop/document.txt") { contents, error in if error == 0 { if let text = String(data: contents, encoding: .utf8) { print("File contents (\(contents.count) bytes):\n\(text)") } } } let textToWrite = "{\"name\": \"SystemKit\", \"version\": \"2.3.2\", \"platform\": [\"iOS\", \"macOS\"]}" if let data = textToWrite.data(using: .utf8) { dispatchFile.write(contents: data, filePath: "/Users/user/Desktop/config.json") { error in if error == 0 { print("File written successfully") } } } let customDispatchFile = SKDispatchFile(qualityOfService: .userInitiated, mode: 0o644) customDispatchFile.write(contents: data, filePath: "/Users/user/Desktop/restricted.txt") { error in print("Write completed with error code: \(error)") } ``` -------------------------------- ### SKSystem - Get Device and OS Information (Swift) Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Shows how to use the SKSystem module to retrieve various system details such as application version, memory usage, device model, and detailed machine information. This module is available on both iOS and macOS. ```swift import SystemKit // Get current application version information if let appVersion = SKSystem.shared.getApplicationVersion() { print("Release Version: \(appVersion.release)") print("Bundle Version: \(appVersion.bundle)") } // Output: // Release Version: 1.0.0 // Bundle Version: 42 // Get memory usage statistics (in Megabytes) let memoryInfo = SKSystem.shared.getMachineUsageMemory() print("Memory Usage: \(memoryInfo.usage) MB") print("Total Memory: \(memoryInfo.total) MB") // Output: // Memory Usage: 256.5 MB // Total Memory: 16384.0 MB // Get device model name let modelName = SKSystem.shared.getDeviceModelName() print("Device Model: \(modelName)") // Output: Device Model: MacBookPro18,3 // Get detailed machine system information if let machineInfo = SKSystem.shared.getMachineSystemInfo() { print("OS Name: \(machineInfo.operatingSystemName)") print("OS Release: \(machineInfo.operatingSystemRelease)") print("OS Version: \(machineInfo.operatingSystemVersion)") print("Network Node: \(machineInfo.machineNetworkNodeName)") print("Hardware Platform: \(machineInfo.machineHardwarePlatform)") } // Output: // OS Name: Darwin // OS Release: 23.1.0 // OS Version: Darwin Kernel Version 23.1.0 // Network Node: MacBook-Pro.local // Hardware Platform: arm64 ``` -------------------------------- ### Get Network Interface Information with SKNetworkInterface (Swift) Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Retrieves and prints detailed information for all network interfaces on the device, including IP addresses (IPv4/IPv6), MAC addresses, and interface flags. It requires the SystemKit framework. ```swift import SystemKit // Get all network interfaces on the device let interfaces = SKNetworkInterface.shared.allInterfaces() for interface in interfaces { print("Interface Name: \(interface.interfaceName)") print(" Family: \(interface.interfaceFamily)") print(" IP Address: \(interface.ipAddress ?? "N/A")") print(" MAC Address: \(interface.macAddress ?? "N/A")") print(" Netmask: \(interface.netmask ?? "N/A")") print(" Broadcast: \(interface.broadcastAddress ?? "N/A")") print(" Flags: \(interface.ifaFlags)") print("---") } // Example output: // Interface Name: en0 // Family: IPv4 // IP Address: 192.168.1.100 // MAC Address: a4:83:e7:12:34:56 // Netmask: 255.255.255.0 // Broadcast: 192.168.1.255 // Flags: 32843 // --- // Interface Name: en0 // Family: IPv6 // IP Address: fe80::1234:5678:abcd:ef01 // MAC Address: a4:83:e7:12:34:56 // Netmask: ffff:ffff:ffff:ffff:: // Broadcast: N/A // Flags: 32843 ``` -------------------------------- ### Execute Processes and Scripts with SKProcess Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Provides a wrapper for executing system processes and shell scripts. It supports I/O piping, termination handlers, and error completion callbacks for robust process management. ```swift import SystemKit let outputPipe = Pipe() SKProcess.shared.run( launchPath: "/bin/bash", arguments: ["-c", "echo 'Hello from SystemKit'"], standardOutput: outputPipe, terminationHandler: { process in print("Script finished with exit code: \(process.terminationStatus)") } ) let outputData = outputPipe.fileHandleForReading.readDataToEndOfFile() if let output = String(data: outputData, encoding: .utf8) { print("Command output: \(output)") } ``` -------------------------------- ### Monitor File System Events with SKDispatchFileMonitor Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Demonstrates how to monitor specific file system events such as writes, deletions, and attribute changes. It supports both direct event handlers and NotificationCenter observers. ```swift import SystemKit let eventMask: DispatchSource.FileSystemEvent = [.write, .delete, .rename, .attrib] let monitor = SKDispatchFileMonitor( filePath: "/Users/user/Desktop/watched_file.txt", eventMask: eventMask ) { event in if event.contains(.write) { print("File was modified") } if event.contains(.delete) { print("File was deleted") } if event.contains(.rename) { print("File was renamed") } if event.contains(.attrib) { print("File attributes changed") } } monitor?.start() NotificationCenter.default.addObserver( forName: SKDispatchFileMonitor.name, object: nil, queue: .main ) { notification in if let event = notification.object as? DispatchSource.FileSystemEvent { print("Received file event via notification: \(event)") } } monitor?.stop() ``` -------------------------------- ### Add Universal SystemKit via Swift Package Manager Source: https://github.com/changyeop-yang/universal-systemkit/blob/main/README.md This snippet demonstrates how to add the Universal SystemKit library to your Xcode project using the Swift Package Manager. It shows two methods: adding from a specific branch ('master') or from a specific version range. ```Swift dependencies: [ .package(url: "https://github.com/ChangYeop-Yang/Universal-SystemKit", .branch("master")) ] ``` ```Swift dependencies: [ .package(url: "https://github.com/ChangYeop-Yang/Universal-SystemKit", from: Version(2, 4, 0)) ] ``` -------------------------------- ### Handle POSIX Signals with SKSignal Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Shows how to register handlers for system signals like SIGUSR1, SIGTERM, and SIGINT. This allows applications to perform graceful shutdowns or respond to user interrupts. ```swift import SystemKit let userSignal = SKSignal(signal: SIGUSR1) { signalNumber in print("Received SIGUSR1 signal: \(signalNumber)") } OperationQueue.main.addOperation(userSignal) let terminateSignal = SKSignal(signal: SIGTERM) { signalNumber in print("Received SIGTERM - initiating graceful shutdown") } OperationQueue.main.addOperation(terminateSignal) let interruptSignal = SKSignal(signal: SIGINT) { signalNumber in print("Received SIGINT - user interrupted") } OperationQueue.main.addOperation(interruptSignal) userSignal.cancel() terminateSignal.cancel() interruptSignal.cancel() ``` -------------------------------- ### Perform AES Encryption and Decryption with SKSecurity Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Demonstrates how to use SKSecurity to perform AES-128, AES-192, and AES-256 encryption and decryption. It requires a valid key of the appropriate length and an initialization vector. ```swift import SystemKit import SystemKit_Objc let iv = SKSecurity.shared().createInitializationVector() let key = "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2" let plaintext = "Sensitive data to encrypt" guard let rawData = plaintext.data(using: .utf8) else { fatalError() } let encrypted = SKSecurity.shared().encrypt(key, .AES256, iv, rawData) let decrypted = SKSecurity.shared().decrypt(key, .AES256, iv, encrypted) if let decryptedString = String(data: decrypted, encoding: .utf8) { print("Decrypted text: \(decryptedString)") } ``` -------------------------------- ### Manage Concurrent Operations with SKAsyncOperation Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Demonstrates how to subclass SKAsyncOperation for asynchronous tasks and manage them using an OperationQueue. It covers state management, cancellation handling, and completion blocks. ```swift import SystemKit class DownloadOperation: SKAsyncOperation { let url: URL var downloadedData: Data? init(url: URL) { self.url = url super.init() } override func start() { super.start() URLSession.shared.dataTask(with: url) { [weak self] data, response, error in guard let self = self else { return } if self.isCancelled { self.state = .finished return } self.downloadedData = data print("Download completed for: \(self.url)") self.state = .finished }.resume() } override func cancel() { super.cancel() print("Download cancelled for: \(url)") } } let queue = OperationQueue() queue.maxConcurrentOperationCount = 3 let urls = [URL(string: "https://example.com/file1.json")!, URL(string: "https://example.com/file2.json")!, URL(string: "https://example.com/file3.json")!] let operations = urls.map { DownloadOperation(url: $0) } operations.last?.completionBlock = { print("All downloads completed") } queue.addOperations(operations, waitUntilFinished: false) operations.first?.cancel() ``` -------------------------------- ### SKSystem - System Information Retrieval Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Methods for accessing device model, application version, memory usage, and detailed machine system information. ```APIDOC ## SKSystem Methods ### Description Provides access to device and operating system information including memory usage, application version, and machine details. ### Methods - getApplicationVersion() -> AppVersion? - getMachineUsageMemory() -> MemoryUsage - getDeviceModelName() -> String - getMachineSystemInfo() -> MachineInfo? ### Usage Example ```swift import SystemKit // Get memory usage statistics let memoryInfo = SKSystem.shared.getMachineUsageMemory() print("Memory Usage: \(memoryInfo.usage) MB") ``` ### Response - **MemoryUsage** (object) - Contains usage and total memory in MB. - **AppVersion** (object) - Contains release and bundle version strings. ``` -------------------------------- ### Monitor Process Lifecycle Events with SKProcessMonitor Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Demonstrates how to track process state changes such as exit, fork, and exec using the SKProcessMonitor class. It utilizes OperationQueue to manage monitoring tasks asynchronously. ```swift import SystemKit let targetPID: pid_t = 12345 let exitMonitor = SKProcessMonitor( name: "ExitMonitor", qualityOfService: .userInitiated, queuePriority: .high, pid: targetPID, fflag: .exit ) { descriptor, flag, rawValue in print("Process \(targetPID) exited!") } let monitorQueue = OperationQueue() monitorQueue.addOperation(exitMonitor) let forkMonitor = SKProcessMonitor(pid: targetPID, fflag: .fork) { _, _, _ in print("Process \(targetPID) forked a child process") } OperationQueue.main.addOperation(forkMonitor) let execMonitor = SKProcessMonitor(pid: targetPID, fflag: .exec) { _, _, _ in print("Process \(targetPID) executed a new program") } OperationQueue.main.addOperation(execMonitor) exitMonitor.cancel() forkMonitor.cancel() execMonitor.cancel() ``` -------------------------------- ### Manage System Permissions with SKPermission Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Shows how to check system permissions and navigate to specific System Preferences panes on macOS. This utility helps manage privacy settings for services like Full Disk Access and Screen Capture. ```swift import SystemKit let hasFullDiskAccess = SKPermission.shared.isFullDiskAccessPermission() SKPermission.shared.openPreferencePane(path: SKDefaultPreferencePane.Screentime.rawValue) SKPermission.shared.managePrivacyPermission( service: .SystemPolicyDesktopFolder, bundlePath: "com.apple.Terminal" ) ``` -------------------------------- ### SKNetworkMonitor - Real-time Network Status Monitoring (Swift) Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Demonstrates how to use SKNetworkMonitor to track network connectivity changes in real-time using Apple's Network framework. It can detect various connection types like WiFi, Ethernet, and Cellular. ```swift import SystemKit // Create network monitor with status update handler let monitor = SKNetworkMonitor { result in // Access the NWPath for detailed network information print("Network Path: \(result.newPath)") // Check connection status print("Is Connected: \(result.status.isConnected)") print("Status Image: \(result.status.image)") // Get connection type (WiFi, Ethernet, Cellular, etc.) print("Connection Type: \(result.connectionType)") } // Start monitoring network status changes monitor.startMonitor() // Perform network operations... // Stop monitoring when done monitor.stopMonitor() // Example output when network changes: // Network Path: satisfied (Path is satisfied), interface: en0 // Is Connected: true // Status Image: wifi // Connection Type: wifi ``` -------------------------------- ### Manage Finder Sync Extensions with SKFinderExtension Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Provides methods to programmatically enable, disable, and register Finder Sync extensions. Supports both blocking and non-blocking operations. ```swift import SystemKit if #available(macOS 10.14, *) { let isEnabled = SKFinderExtension.shared.isExtensionEnabled print("Finder extension enabled: \(isEnabled)") } SKFinderExtension.shared.append(extensionPath: "com.mycompany.myapp.FinderSync", waitUntilExit: true) SKFinderExtension.shared.enable(extensionPath: "com.mycompany.myapp.FinderSync", waitUntilExit: true) SKFinderExtension.shared.disable(extensionPath: "com.mycompany.myapp.FinderSync", waitUntilExit: true) SKFinderExtension.shared.enable(extensionPath: "com.mycompany.myapp.FinderSync", waitUntilExit: false) ``` -------------------------------- ### SKPermission - System Permission Management Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Facilitates the management of various system permissions on iOS and macOS, including Full Disk Access, Photos, Contacts, and Calendar. It also allows opening preference panes directly. ```APIDOC ## SKPermission - System Permission Management SKPermission helps manage various system permissions on iOS and macOS, including Full Disk Access, Photos, Contacts, Calendar, and more, with the ability to open preference panes directly. ### Usage ```swift import SystemKit // Check Full Disk Access permission (macOS) let hasFullDiskAccess = SKPermission.shared.isFullDiskAccessPermission() print("Full Disk Access: \(hasFullDiskAccess)") // Open System Preferences to specific pane SKPermission.shared.openPreferencePane(path: SKDefaultPreferencePane.Screentime.rawValue) // Open Sharing preferences SKSystem.shared.openPreferencePane(path: SKSharingPreferencePane.Main.rawValue) // Manage privacy permissions for specific app SKPermission.shared.managePrivacyPermission( service: .SystemPolicyDesktopFolder, bundlePath: "com.apple.Terminal" ) // Available permission services: // .AddressBook - Contacts access // .Calendar - Calendar access // .Camera - Camera access // .Microphone - Microphone access // .Photos - Photos library access // .Location - Location services // .Bluetooth - Bluetooth access // .ScreenCapture - Screen recording // .Accessibility - Accessibility features // .SystemPolicyFullDiskAccess - Full disk access // .SystemPolicyDesktopFolder - Desktop folder access // .SystemPolicyDocumentsFolder - Documents folder access // .SystemPolicyDownloadsFolder - Downloads folder access ``` ``` -------------------------------- ### Implement File Locking with SKFileLock Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Shows how to acquire and release file locks for read and write operations to prevent race conditions. Supports both file paths and file descriptors. ```swift import SystemKit let readLocker = SKFileLock(filePath: "/Users/user/Desktop/data.txt", .read) if readLocker.lock() { if let contents = FileManager.default.contents(atPath: "/Users/user/Desktop/data.txt") { let text = String(data: contents, encoding: .utf8) print("File contents: \(text ?? "")") } readLocker.unlock() } let writeLocker = SKFileLock(filePath: "/Users/user/Desktop/output.txt", .write) if writeLocker.lock() { let data = "New content".data(using: .utf8)! FileManager.default.createFile(atPath: "/Users/user/Desktop/output.txt", contents: data) writeLocker.unlock() } let fileDescriptor: Int32 = open("/Users/user/Desktop/file.txt", O_RDWR) let fdLocker = SKFileLock(fileDescriptor: fileDescriptor) fdLocker.lock() fdLocker.unlock() close(fileDescriptor) ``` -------------------------------- ### SKUserDefaults - Property Wrapper Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Provides a convenient property wrapper for storing and retrieving values from UserDefaults with support for default values. ```APIDOC ## PROPERTY WRAPPER @SKUserDefaults ### Description Automatically persists properties to UserDefaults. When the property is set, it is saved to the underlying storage; when accessed, it retrieves the current value or the specified default. ### Parameters - **forKey** (String) - Required - The key used to store the value in UserDefaults. - **defaultValue** (Any) - Optional - The value returned if no entry exists for the given key. ### Usage Example @SKUserDefaults(forKey: "username", defaultValue: "Guest") var username: String? ``` -------------------------------- ### Use SKUserDefaults Property Wrapper for UserDefaults (Swift) Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Provides a convenient property wrapper for simplifying the storage and retrieval of values from UserDefaults. It supports standard data types and optional values, automatically handling persistence. ```swift import SystemKit class SettingsManager { // String with default value @SKUserDefaults(forKey: "username", defaultValue: "Guest") var username: String? // Integer with default value @SKUserDefaults(forKey: "loginCount", defaultValue: 0) var loginCount: Int? // Double for storing preferences @SKUserDefaults(forKey: "volumeLevel", defaultValue: 0.5) var volumeLevel: Double? // Bool for feature flags @SKUserDefaults(forKey: "isDarkModeEnabled", defaultValue: false) var isDarkModeEnabled: Bool? // Optional without default value @SKUserDefaults(forKey: "lastLoginDate") var lastLoginDate: Date? } // Usage example let settings = SettingsManager() // Read default values print("Username: \(settings.username ?? "N/A")") // Output: Username: Guest print("Login Count: \(settings.loginCount ?? 0)") // Output: Login Count: 0 // Write values (automatically persisted to UserDefaults) settings.username = "JohnDoe" settings.loginCount = 42 settings.isDarkModeEnabled = true settings.lastLoginDate = Date() // Values persist across app launches print("Username: \(settings.username ?? "N/A")") // Output: Username: JohnDoe print("Login Count: \(settings.loginCount ?? 0)") // Output: Login Count: 42 ``` -------------------------------- ### Implement Inter-Process Communication with SKMessagePort (Swift) Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Enables unidirectional message-based communication between threads and processes using CFMessagePort. It allows data exchange between different applications or frameworks. Requires SystemKit and CoreFoundation. ```swift import SystemKit import CoreFoundation // Define the message callback for receiving messages let callback: CFMessagePortCallBack = { local, msgid, data, info -> Unmanaged? in // Cast info to your controller type if needed if let receivedData = data as Data? { let message = String(data: receivedData, encoding: .utf8) ?? "" print("Received message ID: \(msgid), content: \(message)") } return nil } // Define invalidation callback for cleanup let invalidationCallback: CFMessagePortInvalidationCallBack = { port, info in print("Message port has been invalidated") } // Create message port with a unique name let messagePort = SKMessagePort(portName: "com.myapp.messageport", invalidationCallback) // Start listening for messages on a background queue let success = messagePort.listen(dispatch: .global(qos: .userInitiated), info: self, callback) print("Listening: \(success)") // Send a message to the port if let messageData = "Hello from SystemKit!".data(using: .utf8) { let result = messagePort.send(messageID: 777, message: messageData) switch result { case .success(let code): print("Message sent successfully with code: \(code)") case .failure(let error): print("Failed to send message: \(error.localizedDescription)") } } // Cleanup when done messagePort.invalidate() ``` -------------------------------- ### SKNetworkMonitor - Network Status Monitoring Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Real-time monitoring of network connectivity changes using Apple's Network framework. ```APIDOC ## SKNetworkMonitor ### Description Monitors network connectivity changes in real-time, detecting WiFi, Ethernet, Cellular, and LoopBack connections. ### Methods - init(completion: @escaping (NetworkResult) -> Void) - startMonitor() - stopMonitor() ### Usage Example ```swift let monitor = SKNetworkMonitor { result in print("Is Connected: \(result.status.isConnected)") } monitor.startMonitor() ``` ### Response - **NetworkResult** (object) - Contains the newPath, connection status, and connection type. ``` -------------------------------- ### SKNetworkInterface - Network Interface Information Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Retrieves detailed information about all network interfaces on the device, including IP addresses, MAC addresses, and interface flags. ```APIDOC ## GET SKNetworkInterface.shared.allInterfaces() ### Description Retrieves a list of all network interfaces available on the device. ### Method GET ### Endpoint SKNetworkInterface.shared.allInterfaces() ### Response #### Success Response - **interfaces** (Array) - A list of objects containing interfaceName, interfaceFamily, ipAddress, macAddress, netmask, broadcastAddress, and ifaFlags. ``` -------------------------------- ### SKSecurity - AES Encryption/Decryption Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Provides AES encryption and decryption capabilities using AES-128, AES-192, or AES-256 with CBC mode. Implemented in Objective-C++ for performance. ```APIDOC ## SKSecurity - AES Encryption/Decryption SKSecurity provides AES encryption and decryption using AES-128, AES-192, or AES-256 with CBC (Cipher Block Chaining) mode, implemented in Objective-C++ for optimal performance. ### Usage ```swift import SystemKit import SystemKit_Objc // Generate a random initialization vector let iv = SKSecurity.shared().createInitializationVector() print("Generated IV: \(iv)") // AES-256 key (64 hex characters = 256 bits) let key = "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2" // Data to encrypt let plaintext = "Sensitive data to encrypt" guard let rawData = plaintext.data(using: .utf8) else { fatalError("Failed to convert string to data") } // Encrypt the data using AES-256 let encrypted = SKSecurity.shared().encrypt(key, .AES256, iv, rawData) print("Encrypted data: \(encrypted.base64EncodedString())") // Decrypt the data let decrypted = SKSecurity.shared().decrypt(key, .AES256, iv, encrypted) if let decryptedString = String(data: decrypted, encoding: .utf8) { print("Decrypted text: \(decryptedString)") } // Output: Decrypted text: Sensitive data to encrypt // AES-128 example (32 hex characters = 128 bits) let key128 = "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6" let encrypted128 = SKSecurity.shared().encrypt(key128, .AES128, iv, rawData) let decrypted128 = SKSecurity.shared().decrypt(key128, .AES128, iv, encrypted128) // AES-192 example (48 hex characters = 192 bits) let key192 = "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4" let encrypted192 = SKSecurity.shared().encrypt(key192, .AES192, iv, rawData) let decrypted192 = SKSecurity.shared().decrypt(key192, .AES192, iv, encrypted192) // Key size requirements: // AES-128: 16 bytes (32 hex chars or 24 base64 chars) // AES-192: 24 bytes (48 hex chars or 32 base64 chars) // AES-256: 32 bytes (64 hex chars or 44 base64 chars) ``` ``` -------------------------------- ### Implement Crash Reporting with SKCrashReporter Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Captures application crashes using PLCrashReporter. It requires a signal handler callback and allows for persistence of crash logs to a specified directory for post-mortem analysis. ```swift import SystemKit import CrashReporter let handleSignal: PLCrashReporterPostCrashSignalCallback = { info, uap, context in print("Crash signal received") } let crashReporter = SKCrashReporter( crashReportDirectory: "/Users/user/Library/Logs/CrashReports", crashReportFileName: "MyApp_CrashReport" ) do { try crashReporter.enable(handleSignal: handleSignal) } catch { print("Failed to enable crash reporter: \(error)") } if let result = try? crashReporter.getCrashReport() { print("Previous crash detected!\nReport: \(result.report)") } try? crashReporter.disable() ``` -------------------------------- ### SKMessagePort - Inter-Process Communication Source: https://context7.com/changyeop-yang/universal-systemkit/llms.txt Enables message-based unidirectional communication between threads and processes using CFMessagePort. ```APIDOC ## POST SKMessagePort.send() ### Description Sends a message to a specific port name for inter-process communication. ### Method POST ### Parameters - **messageID** (Int) - Required - Unique identifier for the message. - **message** (Data) - Required - The payload data to be sent. ### Response #### Success Response - **result** (SKMessagePortResult) - Returns .success(code) on successful delivery. #### Error Response - **result** (SKMessagePortResult) - Returns .failure(error) if the message could not be delivered. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.