{"id":24302867,"url":"https://github.com/digipolitan/swift-code-writer","last_synced_at":"2026-05-27T21:31:55.580Z","repository":{"id":98675936,"uuid":"100468270","full_name":"Digipolitan/swift-code-writer","owner":"Digipolitan","description":null,"archived":false,"fork":false,"pushed_at":"2019-01-06T21:38:09.000Z","size":62,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-06T14:31:32.582Z","etag":null,"topics":["builder","source-code","swift","writer"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Digipolitan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-08-16T08:46:00.000Z","updated_at":"2019-01-15T14:22:59.000Z","dependencies_parsed_at":"2023-04-14T01:46:53.924Z","dependency_job_id":null,"html_url":"https://github.com/Digipolitan/swift-code-writer","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Digipolitan/swift-code-writer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fswift-code-writer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fswift-code-writer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fswift-code-writer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fswift-code-writer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Digipolitan","download_url":"https://codeload.github.com/Digipolitan/swift-code-writer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fswift-code-writer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33585203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"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":["builder","source-code","swift","writer"],"created_at":"2025-01-17T00:19:56.760Z","updated_at":"2026-05-27T21:31:55.563Z","avatar_url":"https://github.com/Digipolitan.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"SwiftCodeWriter\n=================================\n\n[![Swift Version](https://img.shields.io/badge/swift-4.2-orange.svg?style=flat)](https://developer.apple.com/swift/)\n[![Swift Package Manager](https://rawgit.com/jlyonsmith/artwork/master/SwiftPackageManager/swiftpackagemanager-compatible.svg)](https://swift.org/package-manager/)\n[![Twitter](https://img.shields.io/badge/twitter-@Digipolitan-blue.svg?style=flat)](http://twitter.com/Digipolitan)\n\nLibrary to write swift source code\n\n## Installation\n\n### SPM\n\nTo install SwiftCodeWriter with SwiftPackageManager, add the following lines to your `Package.swift`.\n\n```swift\nlet package = Package(\n    name: \"XXX\",\n    products: [\n        .library(\n            name: \"XXX\",\n            targets: [\"XXX\"]),\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/Digipolitan/swift-code-writer.git\", from: \"1.0.0\")\n    ],\n    targets: [\n        .target(\n            name: \"XXX\",\n            dependencies: [\"SwiftCodeWriter\"])\n    ]\n)\n```\n\n## The Basics\n\nThe you must create a file description that represent the swift output file\n\n```swift\nlet fileDescription = FileDescription()\n```\n\nA file description can contains :\n- classes `[ClassDescription]`\n- enums `[EnumDescription]`\n- protocols `[ProtocolDescription]`\n- extensions `[ExtensionDescription]`\n- methods `[MethodDescription]`\n- properties `[PropertyDescription]`\n- documentation\n\nThe following example will show how to register a structure inside the file description\n\n```swift\n// Add a User struct with 2 properties\nvar cd = ClassDescription(name: \"User\", options: .init(visibility: .public, isReferenceType: true))\ncd.properties.append(.init(name: \"lastName\", type: \"String?\"))\ncd.properties.append(.init(name: \"firstName\", type: \"String?\"))\nfileDescription.classes.append(cd)\n```\n\nAfter that use the FileWriter to transform the given FileDescription to string as follow\n\n```swift\nlet res = FileWriter.default.write(description: fileDescription)\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more details!\n\nThis project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).\nBy participating, you are expected to uphold this code. Please report\nunacceptable behavior to [contact@digipolitan.com](mailto:contact@digipolitan.com).\n\n## License\n\nSwiftCodeWriter is licensed under the [BSD 3-Clause license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigipolitan%2Fswift-code-writer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigipolitan%2Fswift-code-writer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigipolitan%2Fswift-code-writer/lists"}