{"id":17146230,"url":"https://github.com/inamiy/zelkova","last_synced_at":"2025-07-26T00:14:55.393Z","repository":{"id":49746498,"uuid":"79030379","full_name":"inamiy/Zelkova","owner":"inamiy","description":"Elm/React.js-like architecture in Swift, powered by ReactiveSwift and LayoutKit.","archived":false,"fork":false,"pushed_at":"2017-01-15T12:26:23.000Z","size":21,"stargazers_count":69,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T10:13:24.032Z","etag":null,"topics":["automaton","elm","layoutkit","reactiveswift","state-machine","swift"],"latest_commit_sha":null,"homepage":null,"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/inamiy.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":"2017-01-15T12:10:08.000Z","updated_at":"2024-05-22T15:51:12.000Z","dependencies_parsed_at":"2022-09-24T04:42:13.652Z","dependency_job_id":null,"html_url":"https://github.com/inamiy/Zelkova","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/inamiy/Zelkova","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inamiy%2FZelkova","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inamiy%2FZelkova/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inamiy%2FZelkova/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inamiy%2FZelkova/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inamiy","download_url":"https://codeload.github.com/inamiy/Zelkova/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inamiy%2FZelkova/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267092312,"owners_count":24034750,"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-07-25T02:00:09.625Z","response_time":70,"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":["automaton","elm","layoutkit","reactiveswift","state-machine","swift"],"created_at":"2024-10-14T21:08:10.387Z","updated_at":"2025-07-26T00:14:55.354Z","avatar_url":"https://github.com/inamiy.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zelkova\n\n[Elm](http://elm-lang.org)/[React.js](https://github.com/facebook/react)-like architecture in Swift, powered by [ReactiveSwift](https://github.com/ReactiveCocoa/ReactiveSwift) and [LayoutKit](https://github.com/linkedin/LayoutKit).\n\n\u003e **Zelkova** is a genus of six species of deciduous trees in the **elm family** Ulmaceae ([Wikipedia](https://en.wikipedia.org/wiki/Zelkova)).\n\nPlease also check out a sister project: [inamiy/SwiftElm](https://github.com/inamiy/SwiftElm) (if you like black magic ✨🔮✨)\n\n## Example\n\nA simple button tap (increment) example in [ZelkovaPlayground](ZelkovaPlayground.playground).\n\n```swift\nimport UIKit\nimport PlaygroundSupport\nimport LayoutKit\nimport Zelkova\n\nlet rootSize = CGSize(width: 320, height: 480)\n\nenum Msg: Message\n{\n    case increment\n}\n\ntypealias Model = Int\n\nfunc update(model: Model, msg: Msg) -\u003e Model?\n{\n    switch msg {\n        case .increment:\n            return model + 1\n    }\n}\n\nfunc view(_ model: Model, send: @escaping (Msg) -\u003e ()) -\u003e ButtonLayout\u003cUIButton\u003e\n{\n    return ButtonLayout\u003cUIButton\u003e(\n        type: .custom,\n        title: \"Tap me! \\(model)\",\n        font: .systemFont(ofSize: 24),\n        contentEdgeInsets: EdgeInsets(top: 10, left: 50, bottom: 10, right: 50),\n        viewReuseId: \"button\",\n        config: {\n            $0.setTitleColor(.white, for: .normal)\n            $0.zelkova.addHandler(for: .touchUpInside) { _ in\n                send(.increment)\n            }\n        }\n    )\n}\n\nlet program = Program(model: 0, update: update, view: view)\n\nPlaygroundPage.current.liveView = program.rootViewController\n```\n\nMajority of the code comes from [LayoutKit](https://github.com/linkedin/LayoutKit), which works not only as a great layout engine but also as **immutable virtual-view framework** (just like [React.js](https://github.com/facebook/react)).\n\nPlease see [ZelkovaPlayground](ZelkovaPlayground.playground) for more examples.\n\n## Terms\n\nTerm    | Type                          | Description\n------- | ----------------------------- | ------------------------------------------\nprogram | `Program` | State-machine wrapper that manages whole application's states, view rendering, and event delivery.\nmodel   | `Model`   | User-defined application's whole state.\nmsg     | `Msg`     | User-defined input (event message) that triggers `Program`'s state-machine.\nupdate  | `(model: Model, msg: Msg) -\u003e Model?`     | State-transition function that takes current state and input as arguments, then returns either a new state (transition success) or `nil` (transition failure). \nview    | `(model: Model, send: @escaping (Msg) -\u003e ()) -\u003e LayoutKit.Layout` | View generating/reusing side-effect that creates `LayoutKit.Layout` (virtual-view) from current state. To let views to send a new `Msg` (e.g. button tap), use `send` to add a new side-effect.\n\n## V.S.\n\n- [Few.swift](https://github.com/joshaber/Few.swift)\n- [Render](https://github.com/alexdrone/Render)\n- [katana-swift](https://github.com/BendingSpoons/katana-swift)\n- [inamiy/SwiftElm](https://github.com/inamiy/SwiftElm)\n\nTBD\n\n## Acknowledgement\n\n- Evan Czaplicki: Creator of [Elm](http://elm-lang.org/)\n- LinkedIn: Creator of [LayoutKit](https://github.com/linkedin/LayoutKit)\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finamiy%2Fzelkova","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finamiy%2Fzelkova","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finamiy%2Fzelkova/lists"}