{"id":13448504,"url":"https://github.com/SwiftWebUI/SwiftWebUI","last_synced_at":"2025-03-22T09:31:24.573Z","repository":{"id":37251609,"uuid":"193968633","full_name":"SwiftWebUI/SwiftWebUI","owner":"SwiftWebUI","description":"A demo implementation of SwiftUI for the Web","archived":false,"fork":false,"pushed_at":"2024-03-02T16:11:08.000Z","size":220,"stargazers_count":4195,"open_issues_count":39,"forks_count":160,"subscribers_count":90,"default_branch":"develop","last_synced_at":"2024-10-29T15:34:16.113Z","etag":null,"topics":["swift-library","swift5","swiftui","swiftui-example","swiftwebui"],"latest_commit_sha":null,"homepage":"http://www.alwaysrightinstitute.com/swiftwebui/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwiftWebUI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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}},"created_at":"2019-06-26T19:52:41.000Z","updated_at":"2024-10-29T02:37:47.000Z","dependencies_parsed_at":"2024-02-03T13:33:29.083Z","dependency_job_id":"e27f31c8-6ac1-40fc-bbd7-81f36315c24f","html_url":"https://github.com/SwiftWebUI/SwiftWebUI","commit_stats":{"total_commits":110,"total_committers":7,"mean_commits":"15.714285714285714","dds":0.4636363636363636,"last_synced_commit":"67194592f7970f40121827f30dcf272d9230adb4"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftWebUI%2FSwiftWebUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftWebUI%2FSwiftWebUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftWebUI%2FSwiftWebUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftWebUI%2FSwiftWebUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwiftWebUI","download_url":"https://codeload.github.com/SwiftWebUI/SwiftWebUI/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937751,"owners_count":20535124,"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":["swift-library","swift5","swiftui","swiftui-example","swiftwebui"],"created_at":"2024-07-31T05:01:47.460Z","updated_at":"2025-03-22T09:31:23.528Z","avatar_url":"https://github.com/SwiftWebUI.png","language":"Swift","readme":"\u003ch2\u003eSwiftWebUI\n  \u003cimg src=\"https://zeezide.com/img/TinkerIcon.svg\"\n       align=\"right\" width=\"128\" height=\"128\" /\u003e\n\u003c/h2\u003e\n\n![Swift5.1](https://img.shields.io/badge/swift-5.1-blue.svg)\n![macOS](https://img.shields.io/badge/os-macOS-green.svg?style=flat)\n![tuxOS](https://img.shields.io/badge/os-tuxOS-green.svg?style=flat)\n![Travis](https://api.travis-ci.org/SwiftWebUI/SwiftWebUI.svg?branch=develop\u0026style=flat)\n\nMore details can be found on the related blog post at the\n[Always Right Institute](http://www.alwaysrightinstitute.com).\n\nAt\n[WWDC 2019](https://developer.apple.com/wwdc19/)\nApple announced \n[SwiftUI](https://developer.apple.com/xcode/swiftui/).\nA single \"cross platform\", \"declarative\" framework used to build \ntvOS, macOS, watchOS and iOS\nUIs.\n[SwiftWebUI](https://github.com/SwiftWebUI/SwiftWebUI)\nis bringing that to the Web ✔️\n\n**Disclaimer**: This is a toy project!\nDo not use for production. \nUse it to learn more about SwiftUI and its inner workings.\n\n## SwiftWebUI\n\nSo what exactly is \nSwiftWebUI?\nIt allows you to write SwiftUI \n[Views](https://developer.apple.com/documentation/swiftui/view)\nwhich display in a web browser:\n\n```swift\nimport SwiftWebUI\n\nstruct MainPage: View {\n  @State var counter = 0\n  \n  func countUp() { \n    counter += 1 \n  }\n  \n  var body: some View {\n    VStack {\n      Text(\"🥑🍞 #\\(counter)\")\n        .padding(.all)\n        .background(.green, cornerRadius: 12)\n        .foregroundColor(.white)\n        .onTapGesture(self.countUp)\n    }\n  }\n}\n```\n\nResults in:\n\n\u003ccenter\u003e\u003cimg src=\"https://zeezide.com/img/AvocadoCounter.gif\" align=\"center\" /\u003e\u003c/center\u003e\n\nUnlike some other efforts this doesn't just render SwiftUI Views\nas HTML. \nIt also sets up a connection between the browser and the code hosted\nin the Swift server, allowing for interaction - \nbuttons, pickers, steppers, lists, navigation, you get it all!\n\nIn other words: \n[SwiftWebUI](https://github.com/SwiftWebUI/SwiftWebUI)\nis an implementation of (many but not all parts of) the SwiftUI API for the browser.\n\nTo repeat the\n**Disclaimer**: This is a toy project!\nDo not use for production. \nUse it to learn more about SwiftUI and its inner workings.\n\n\n## Requirements\n\nOn a Mac macOS 10.15 or later is required.\n\n### tuxOS\n\nSwiftWebUI now runs on Linux using\n[OpenCombine](https://github.com/broadwaylamb/OpenCombine) (also works without\nthat, but then some things don't work, e.g. `NavigationView`).\n\nSwift 5.2 or later is required.\nWe also provide a Docker image containing a 5.1 snapshot over here:\n[helje5/swift](https://cloud.docker.com/repository/docker/helje5/swift/tags).\n\n\n## SwiftWebUI Hello World\n\nTo setup a SwiftWebUI project,\ncreate a \"macOS tool project\" in Xcode 11,\nthen use the new SwiftPM integration and add\n`https://github.com/SwiftWebUI/SwiftWebUI`\nas a dependency.\n\nOpen the `main.swift` file and replace it's content\nwith:\n```swift\nimport SwiftWebUI\n\nSwiftWebUI.serve(Text(\"Holy Cow!\"))\n```\n\nCompile and run the app in Xcode, open Safari and hit\n[`http://localhost:1337/`](http://localhost:1337/):\n\n\u003ccenter\u003e\u003cimg src=\"https://zeezide.com/img/holycow.png\" align=\"center\" width=\"538\" /\u003e\u003c/center\u003e\n  \n\n## 🥑🍞 AvocadoToast\n\nA small SwiftWebUI sample  based on the \n[SwiftUI Essentials](https://developer.apple.com/videos/play/wwdc2019/216)\n\"Avocado Toast App\".\nFind it over here:\n[AvocadoToast](https://github.com/SwiftWebUI/AvocadoToast).\n\n\u003ccenter\u003e\u003cimg src=\"http://zeezide.com/img/AvocadoToast.gif\" align=\"center\" width=\"538\" /\u003e\u003c/center\u003e\n\n\n## Who\n\nBrought to you by\n[Helge Heß](https://github.com/helje5/) / [ZeeZide](https://zeezide.de).\nWe like feedback, GitHub stars, cool contract work, \npresumably any form of praise you can think of.\n","funding_links":[],"categories":["Swift","Samples","swiftwebui"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftWebUI%2FSwiftWebUI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSwiftWebUI%2FSwiftWebUI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftWebUI%2FSwiftWebUI/lists"}