{"id":17688060,"url":"https://github.com/itztravelintime/tinuioregistry","last_synced_at":"2025-04-22T14:45:55.349Z","repository":{"id":64823983,"uuid":"458107035","full_name":"ITzTravelInTime/TINUIORegistry","owner":"ITzTravelInTime","description":"A Swift library to access information from the macOS IORegistry.","archived":false,"fork":false,"pushed_at":"2022-09-11T23:29:36.000Z","size":134,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-25T05:53:29.082Z","etag":null,"topics":["iokit","ioregistryexplorer","macos","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ITzTravelInTime.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-11T08:39:05.000Z","updated_at":"2024-09-17T09:50:08.000Z","dependencies_parsed_at":"2022-12-15T12:43:34.630Z","dependency_job_id":null,"html_url":"https://github.com/ITzTravelInTime/TINUIORegistry","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITzTravelInTime%2FTINUIORegistry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITzTravelInTime%2FTINUIORegistry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITzTravelInTime%2FTINUIORegistry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITzTravelInTime%2FTINUIORegistry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ITzTravelInTime","download_url":"https://codeload.github.com/ITzTravelInTime/TINUIORegistry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229380999,"owners_count":18064093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iokit","ioregistryexplorer","macos","swift"],"created_at":"2024-10-24T11:43:15.584Z","updated_at":"2024-12-12T11:42:49.661Z","avatar_url":"https://github.com/ITzTravelInTime.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TINUIORegistry\nA Swift library to access information from the IORegistry in a Swift-friendly easy-to-use way.\n\n## Features and usage\n\n**Reading the NVRAM:**\n\nThis feature allows you to access the system NVRAM to gather values, here is an exmaple: \n\n(WARNING: This feature might not work with sandboxed apps)\n\n```swift\nimport TINUIORegistry\n\nlet boot_args = TINUIORegistry.IONVRAM.getString(\"boot-args\") ?? \"[Fail]\"\n\nprint(boot_args)\n\n```\n\n**Getting a list of disks and partitions with some info:**\n\nThis feature allows you to get a list of disks and patitions taken from the IORegistry.\n\nThis example lists all the BSD names of available disks and partitions: \n\n```swift\nimport TINUIORegistry\n\nlet list = TINUIORegistry.IODeviceTreeDisk.simpleList()\n\nfor item in list{\n    print(item.DeviceIdentifier.rawValue)\n}\n\n```\n\n**Iterating trought the IORegistry entries:**\n\nThis feature allows for recursive iteration trought the IORegistry tree structure entry by entry.\n\nIn this example it's used to find the RTC entry (for an intel mac) and then prints it's property table:\n\n```swift\nimport TINUIORegistry\n\nlet iterator = IORecursiveIterator(plane: .service) // creates an iterator object\n\nwhile iterator.next(){ //executes the iterations\n    \n    guard let entry = iterator.entry else{ //Tries to get the current registry entry pointed by the iterator.\n        continue\n    }\n    \n    guard let name = entry.getName() else{ //Gets the name of the obtained entry\n        continue\n    }\n    \n    //print(name)\n    \n    if name != \"TMR\" \u0026\u0026 name != \"RTC\" \u0026\u0026 name != \"RTC0\" \u0026\u0026 name != \"RTC1\"{ //checks if the entry name is that of the RTC device\n        continue\n    }\n    \n    //gets and prints the property table of the entry\n    for i in entry.getRawPropertyTable() ?? [:]{\n        print(i)\n    }\n    \n    break //exits from the loop\n}\n\n```\n\n**Using specific IORegistry entries:**\n\nIt's possible to interact with registry entries by initializing a new `IOEntry` object from a string containing a IORegistry entry's path.\n\nHere is an example in which an `IOEntry` object is initialised using the registry path to the system nvram and then the \"boot-arg\" value is retrived from it:\n\n```swift\n\nimport TINUIORegistry\n\nlet nvram = IOEntry(fromRegistryPath: \"IODeviceTree:/options\", plane: .service)\n\nlet boot_args = nvram?.getString(\"boot-args\") ?? \"[Fail]\"\n\nprint(boot_args)\n\n```\n\n## Who should use this Library?\n\nThis library should be used by swift apps/programs for macOS that needs to retrive information from the IORegistry.\n\nThis code is intended for macOS only since it requires the system library 'IOKit'.\n\n## About the project\n\nThis code was created for of my [TINU project](https://github.com/ITzTravelInTime/TINU) and it has been made into it's own library to make the main project's source less complex and more focused on it's aim. \n\nAlso having this as it's own library allows for code to be updated separately and so various versions of the main TINU app will be able to be compiled all with the latest version of this library.\n\n## Libraries used:\n\n- [ITzTravelInTime/SwiftPackagesBase](https://github.com/ITzTravelInTime/SwiftPackagesBase) - Created, developed and maintained by ITzTravelInTime\n\n## Credits\n\n - ITzTravelInTime (Pietro Caruso) - Project creator and main developer\n\n## Contacts\n\n - ITzTravelInTime (Pietro Caruso): piecaruso97@gmail.com\n\n## Legal info\n\nTINUNotifications: A Swift library to access information from the IORegistry in a Swift-friendly easy-to-use way.\nCopyright (C) 2022 Pietro Caruso\n\nThis library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.\n\nThis library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitztravelintime%2Ftinuioregistry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitztravelintime%2Ftinuioregistry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitztravelintime%2Ftinuioregistry/lists"}