{"id":1855,"url":"https://github.com/wickwirew/Runtime","last_synced_at":"2025-08-02T05:32:47.861Z","repository":{"id":45238723,"uuid":"109459730","full_name":"wickwirew/Runtime","owner":"wickwirew","description":"A Swift Runtime library for viewing type info, and the dynamic getting and setting of properties.","archived":false,"fork":false,"pushed_at":"2024-06-04T13:03:55.000Z","size":992,"stargazers_count":1142,"open_issues_count":22,"forks_count":96,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-07-28T14:02:09.715Z","etag":null,"topics":["ios","reflection","runtime","swift","swift4"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wickwirew.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-04T02:13:17.000Z","updated_at":"2025-07-02T08:04:44.000Z","dependencies_parsed_at":"2024-03-11T02:27:18.982Z","dependency_job_id":"6e99d2fd-c167-4f8c-84d8-a2dc359208c8","html_url":"https://github.com/wickwirew/Runtime","commit_stats":{"total_commits":176,"total_committers":19,"mean_commits":9.263157894736842,"dds":0.25,"last_synced_commit":"275fbf843bf4198a732eacde4eff1b21e378edc6"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/wickwirew/Runtime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wickwirew%2FRuntime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wickwirew%2FRuntime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wickwirew%2FRuntime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wickwirew%2FRuntime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wickwirew","download_url":"https://codeload.github.com/wickwirew/Runtime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wickwirew%2FRuntime/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268305451,"owners_count":24229392,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ios","reflection","runtime","swift","swift4"],"created_at":"2024-01-05T20:15:57.385Z","updated_at":"2025-08-02T05:32:47.521Z","avatar_url":"https://github.com/wickwirew.png","language":"Swift","readme":"![Runtime](https://github.com/wickwirew/Runtime/blob/master/Resources/Runtime.png)\n\n\u003c!-- TODO replace with GitHub build badge --\u003e\n![Swift 5.0](https://img.shields.io/badge/Swift-5.0-green.svg)\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/Runtime.svg)](#cocoapods)\n[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)\n\nRuntime is a Swift library to give you more runtime abilities, including getting type metadata, setting properties via reflection, and type construction for native swift objects.\n\n## TypeInfo\n`TypeInfo` exposes metadata about native Swift structs, protocols, classes, tuples and enums. It captures the properties, generic types, inheritance levels, and more.\n### Example\nLets say you have a User struct:\n```swift\nstruct User {\n  let id: Int\n  let username: String\n  let email: String\n}\n```\nTo get the `TypeInfo` of `User`, all that you have to do is:\n```swift\nlet info = try typeInfo(of: User.self)\n```\n\n## Property Info\nWithin the `TypeInfo` object, it contains a list of `PropertyInfo` which represents all properties for the type. `PropertyInfo` exposes the name and type of the property. It also allows the getting and setting of a value on an object.\n### Example\nUsing the same `User` object as before first we get the `TypeInfo` and the property we want.\n```swift\nlet info = try typeInfo(of: User.self)\nlet property = try info.property(named: \"username\")\n```\nTo get a value:\n```swift\nlet username = try property.get(from: user)\n```\nTo set a value:\n```swift\ntry property.set(value: \"newUsername\", on: \u0026user)\n```\nIt's that easy! 🎉\n\n## Factory\nRuntime also supports building an object from it's `Type`. Both structs and classes are supported.\n\nTo build a `User` object:\n```swift\nlet user = try createInstance(type: User.self)\n```\n\n## Function Info\n`FunctionInfo` exposes metadata about functions. Including number of arguments, argument types, return types, and whether it can throw an error.\n### Example\n```swift\nfunc doSomething(a: Int, b: Bool) throws -\u003e String { \n  return \"\" \n}\n\nlet info = functionInfo(of: doSomething)\n```\n\n## FAQ\nQ: When getting and setting a value does it work typeless? (i.e. object casted as `Any`)\n\nA: Yes! The whole library was designed with working typeless in mind.\n\nQ: When creating a new instance of a class is it still protected by ARC?\n\nA: Yes! The retain counts are set properly so ARC can do its job. \n\n## Installation\n### Cocoapods\nRuntime is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n```ruby\npod 'Runtime'\n```\n### Swift Package Manager\n\nYou can install Runtime via [Swift Package Manager](https://swift.org/package-manager/) by adding the following line to your `Package.swift`:\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    [...]\n    dependencies: [\n        .Package(url: \"https://github.com/wickwirew/Runtime.git\", majorVersion: XYZ)\n    ]\n)\n```\n\n## Contributions\nContributions are welcome and encouraged!\n\n## Learn\nWant to know how it works? \n[Here's an article](https://medium.com/@weswickwire/creating-a-swift-runtime-library-3cc92fc486cc) on how it was implemented.\n\nWant to learn about Swift memory layout?\n[Mike Ash](https://github.com/mikeash) gave and awesome [talk](https://academy.realm.io/posts/goto-mike-ash-exploring-swift-memory-layout/) on just that.\n\n## License\nRuntime is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["Reflection","Swift","swift4"],"sub_categories":["React-Like","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwickwirew%2FRuntime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwickwirew%2FRuntime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwickwirew%2FRuntime/lists"}