{"id":15288677,"url":"https://github.com/mchakravarty/codeeditorview","last_synced_at":"2025-05-15T02:04:39.240Z","repository":{"id":37934919,"uuid":"368609018","full_name":"mchakravarty/CodeEditorView","owner":"mchakravarty","description":"SwiftUI code editor view for iOS, visionOS, and macOS","archived":false,"fork":false,"pushed_at":"2025-04-06T16:19:01.000Z","size":2261,"stargazers_count":744,"open_issues_count":52,"forks_count":70,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-06T21:06:36.968Z","etag":null,"topics":["editor","ios","macos","swiftui","visionos"],"latest_commit_sha":null,"homepage":"","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/mchakravarty.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":"2021-05-18T17:09:01.000Z","updated_at":"2025-04-05T19:33:24.000Z","dependencies_parsed_at":"2024-02-04T21:24:44.960Z","dependency_job_id":"94083463-2e45-4534-9c45-28336f45e653","html_url":"https://github.com/mchakravarty/CodeEditorView","commit_stats":{"total_commits":285,"total_committers":9,"mean_commits":"31.666666666666668","dds":0.04210526315789476,"last_synced_commit":"95821fd7e7d8c49c1af393efa1506d07dc15c4bb"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchakravarty%2FCodeEditorView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchakravarty%2FCodeEditorView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchakravarty%2FCodeEditorView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchakravarty%2FCodeEditorView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mchakravarty","download_url":"https://codeload.github.com/mchakravarty/CodeEditorView/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799903,"owners_count":21163400,"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":["editor","ios","macos","swiftui","visionos"],"created_at":"2024-09-30T15:52:02.314Z","updated_at":"2025-05-15T02:04:39.217Z","avatar_url":"https://github.com/mchakravarty.png","language":"Swift","readme":"# SwiftUI code editor view for iOS, visionOS, and macOS\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fmchakravarty%2FCodeEditorView%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/mchakravarty/CodeEditorView)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fmchakravarty%2FCodeEditorView%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/mchakravarty/CodeEditorView)\n\nThe package `CodeEditorView` provides a SwiftUI view implementing a code editor for iOS, visionOS, and macOS whose visual style is inspired by Xcode and that is based on TextKit 2. The currently supported functionality includes syntax highlighting with configurable themes, inline message reporting (warnings, errors, etc), bracket matching, matching bracket insertion, current line highlighting, common code editing operations, and a minimap.\n\nOn macOS, `CodeEditorView` also supports (1) displaying information about identifiers (such as type information and documentation provided in Markdown) as well as (2) code completion. This support is independent of how the underlying information is computed — a common choice is to use a language server based on the Language Server Protocol (LSP). This functionality will eventually also be supported on iOS.\n\n## Screenshots of the demo app\n\nThis is the default dark theme on macOS. Like in Xcode, messages have got an inline view on the right-hand side of the screen, which pops up into a larger overlay to display more information. The minimap on the right provides an outline of the edited text.\n\n\u003cimg src=\"app-demo-images/macOS-dark-example.png\"\u003e\n\nThe following is the default light theme on iOS. \n\n\u003cimg src=\"app-demo-images/iOS-light-example.png\"\u003e\n\n\n## How to use it\n\nTypical usage of the view is as follows.\n\n```swift\nimport SwiftUI\nimport CodeEditorView\nimport LanguageSupport\n\nstruct ContentView: View {\n  @State private var text:     String                    = \"My awesome code...\"\n  @State private var position: CodeEditor.Position       = CodeEditor.Position()\n  @State private var messages: Set\u003cTextLocated\u003cMessage\u003e\u003e = Set()\n\n  @Environment(\\.colorScheme) private var colorScheme: ColorScheme\n\n  var body: some View {\n    CodeEditor(text: $text, position: $position, messages: $messages, language: .swift())\n      .environment(\\.codeEditorTheme,\n                   colorScheme == .dark ? Theme.defaultDark : Theme.defaultLight)\n  }\n}\n```\n\n\n## Demo app\n\nTo see the `CodeEditorView` in action, have a look at the repo with a [cross-platform demo app](https://github.com/mchakravarty/CodeEditorDemo).\n\n\n## Documentation\n\nFor more information, see the [package documentation](Documentation/Overview.md).\n\n\n## Status\n\nI consider this package still to be of pre-release quality, but at this stage, it is mostly a set of known bugs, which prevents it from being a 1.0.\n\n## License\n\nCopyright [2021..2025] Manuel M. T. Chakravarty. \n\nDistributed under the Apache-2.0 license — see the [license file](LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchakravarty%2Fcodeeditorview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmchakravarty%2Fcodeeditorview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchakravarty%2Fcodeeditorview/lists"}