{"id":25930315,"url":"https://github.com/shaftui/swiftreload","last_synced_at":"2025-09-12T04:43:36.881Z","repository":{"id":278536097,"uuid":"935941579","full_name":"ShaftUI/SwiftReload","owner":"ShaftUI","description":"Cross-platform Swift hot reload without depending on Xcode.","archived":false,"fork":false,"pushed_at":"2025-07-26T14:47:54.000Z","size":88,"stargazers_count":44,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-06T07:38:35.547Z","etag":null,"topics":["cross-platform","hot-reload","shaftui","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShaftUI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-02-20T09:16:45.000Z","updated_at":"2025-08-27T06:09:37.000Z","dependencies_parsed_at":"2025-02-20T10:27:58.919Z","dependency_job_id":"b592fdad-b7f3-4c04-93e6-d69aef0f3a85","html_url":"https://github.com/ShaftUI/SwiftReload","commit_stats":null,"previous_names":["shaftui/swiftreload"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ShaftUI/SwiftReload","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaftUI%2FSwiftReload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaftUI%2FSwiftReload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaftUI%2FSwiftReload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaftUI%2FSwiftReload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShaftUI","download_url":"https://codeload.github.com/ShaftUI/SwiftReload/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaftUI%2FSwiftReload/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274754954,"owners_count":25343137,"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-09-12T02:00:09.324Z","response_time":60,"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":["cross-platform","hot-reload","shaftui","swift"],"created_at":"2025-03-03T23:01:20.069Z","updated_at":"2025-09-12T04:43:36.829Z","avatar_url":"https://github.com/ShaftUI.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftReload\n\nThis is an experimental project that enables hot reloading of Swift code in SwiftPM based projects.\n\n## Platforms\n\n| **Platform** | **CI Status**                                                                                                                                                          | **Support Status** |\n| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |\n| macOS        | [![MacOS](https://github.com/ShaftUI/SwiftReload/actions/workflows/ci-macos.yml/badge.svg)](https://github.com/ShaftUI/SwiftReload/actions/workflows/ci-macos.yml)     | ✅                  |\n| Linux        | [![Linux](https://github.com/ShaftUI/SwiftReload/actions/workflows/ci-linux.yml/badge.svg)](https://github.com/ShaftUI/SwiftReload/actions/workflows/ci-linux.yml)     | ✅                  |\n| Windows      | [![Swift](https://github.com/ShaftUI/SwiftReload/actions/workflows/ci-windows.yml/badge.svg)](https://github.com/ShaftUI/SwiftReload/actions/workflows/ci-windows.yml) | 🚧                  |\n\n## Quick Start\n\n1. Add SwiftReload to your project's dependencies in `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ShaftUI/SwiftReload.git\", branch: \"main\")\n]\n```\n\n2. Add SwiftReload to your target's dependencies:\n\n```swift\n.executableTarget(\n    name: \"MyApp\",\n    dependencies: [\n        \"SwiftReload\"\n    ]\n)\n```\n\n1. Add `-enable-private-imports` and `-enable-implicit-dynamic` flag to your target's build settings:\n\n```swift\n.executableTarget(\n    name: \"MyApp\",\n    dependencies: [\n        \"SwiftReload\"\n    ],\n    swiftSettings: [\n        .unsafeFlags(\n            [\"-Xfrontend\", \"-enable-private-imports\"],\n            .when(configuration: .debug)\n        ),\n        .unsafeFlags(\n            [\"-Xfrontend\", \"-enable-implicit-dynamic\"],\n            .when(configuration: .debug)\n        ),\n    ],\n    linkerSettings: [\n        .unsafeFlags(\n            [\"-Xlinker\", \"--export-dynamic\"],\n            .when(platforms: [.linux, .android], configuration: .debug)\n        ),\n    ]\n)\n```\n\nThis enables method swizzling, which SwiftReload uses to replace code at runtime.\n\n\u003e On Linux, you also need to add the `-Xlinker --export-dynamic` flag to the linker settings to export all symbols from the executable.\n\n3. Add the following code at the beginning of your `main.swift`:\n\n```swift\nimport SwiftReload\n\nLocalSwiftReloader().start()\n```\n\n\u003e For complete example, see the [`Sources/SwiftReloadExample`](https://github.com/ShaftUI/SwiftReload/tree/main/Sources/SwiftReloadExample) directory.\n\n\n## With [ShaftUI](https://github.com/ShaftUI/Shaft)\n\nThe `LocalSwiftReloader` has a `onReload` callback that is called when the code reload is triggered. You can call `backend.scheduleReassemble` in the callback to rebuild the UI.\n\n```swift\n#if DEBUG\n    import SwiftReload\n    LocalSwiftReloader(onReload: backend.scheduleReassemble).start()\n#endif\n```\n\n## How it works\n\nSwiftReload monitors changes to the source files of your project. When a change is detected, it recompiles the updated source files to a dynamic library and loads it into the running process. The dynamic library then replaces the existing code in the process, effectively enabling hot reloading of Swift code.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaftui%2Fswiftreload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaftui%2Fswiftreload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaftui%2Fswiftreload/lists"}