{"id":13595928,"url":"https://github.com/CodeEditApp/CodeEditTextView","last_synced_at":"2025-04-09T13:33:49.984Z","repository":{"id":212181956,"uuid":"730891355","full_name":"CodeEditApp/CodeEditTextView","owner":"CodeEditApp","description":"A text editor specialized for displaying and editing code documents. Written in pure Swift.","archived":false,"fork":false,"pushed_at":"2024-05-21T14:18:54.000Z","size":999,"stargazers_count":39,"open_issues_count":13,"forks_count":5,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-05-21T15:36:59.005Z","etag":null,"topics":["appkit","coretext","macos","swift","text-editor"],"latest_commit_sha":null,"homepage":"https://codeeditapp.github.io/CodeEditTextView/documentation/codeedittextview/","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/CodeEditApp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-12-12T22:45:14.000Z","updated_at":"2024-05-21T15:37:05.829Z","dependencies_parsed_at":"2024-01-28T05:20:17.483Z","dependency_job_id":"23df691b-5301-430d-bc41-fe6b654d6d7d","html_url":"https://github.com/CodeEditApp/CodeEditTextView","commit_stats":null,"previous_names":["codeeditapp/codeedittextview"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeEditApp%2FCodeEditTextView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeEditApp%2FCodeEditTextView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeEditApp%2FCodeEditTextView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeEditApp%2FCodeEditTextView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeEditApp","download_url":"https://codeload.github.com/CodeEditApp/CodeEditTextView/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248049784,"owners_count":21039272,"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":["appkit","coretext","macos","swift","text-editor"],"created_at":"2024-08-01T16:02:01.580Z","updated_at":"2025-04-09T13:33:49.605Z","avatar_url":"https://github.com/CodeEditApp.png","language":"Swift","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/CodeEditApp/CodeEditTextView/blob/main/.github/CodeEditTextView-Icon-128@2x.png?raw=true\" height=\"128\"\u003e\n  \u003ch1 align=\"center\"\u003eCodeEditTextView\u003c/h1\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n  \u003ca aria-label=\"Follow CodeEdit on Twitter\" href=\"https://twitter.com/CodeEditApp\" target=\"_blank\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/badge/Follow%20@CodeEditApp-black.svg?style=for-the-badge\u0026logo=Twitter\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"Join the community on Discord\" href=\"https://discord.gg/vChUXVf9Em\" target=\"_blank\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/badge/Join%20the%20community-black.svg?style=for-the-badge\u0026logo=Discord\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"Read the Documentation\" href=\"https://codeeditapp.github.io/CodeEditSourceEditor/documentation/codeeditsourceeditor/\" target=\"_blank\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/badge/Documentation-black.svg?style=for-the-badge\u0026logo=readthedocs\u0026logoColor=blue\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nA text editor specialized for displaying and editing code documents. Features include basic text editing, extremely fast initial layout, support for handling large documents, customization options for code documents.\n\n![GitHub release](https://img.shields.io/github/v/release/CodeEditApp/CodeEditTextView?color=orange\u0026label=latest%20release\u0026sort=semver\u0026style=flat-square)\n![Github Tests](https://img.shields.io/github/actions/workflow/status/CodeEditApp/CodeEditTextView/tests.yml?branch=main\u0026label=tests\u0026style=flat-square)\n![Documentation](https://img.shields.io/github/actions/workflow/status/CodeEditApp/CodeEditTextView/build-documentation.yml?branch=main\u0026label=docs\u0026style=flat-square)\n![GitHub Repo stars](https://img.shields.io/github/stars/CodeEditApp/CodeEditTextView?style=flat-square)\n![GitHub forks](https://img.shields.io/github/forks/CodeEditApp/CodeEditTextView?style=flat-square)\n[![Discord Badge](https://img.shields.io/discord/951544472238444645?color=5865F2\u0026label=Discord\u0026logo=discord\u0026logoColor=white\u0026style=flat-square)](https://discord.gg/vChUXVf9Em)\n\n\u003e [!IMPORTANT]\n\u003e This package contains a text view suitable for replacing `NSTextView` in some, ***specific*** cases. If you want a text view that can handle things like: right-to-left text, custom layout elements, or feature parity with the system text view, consider using [STTextView](https://github.com/krzyzanowskim/STTextView) or [NSTextView](https://developer.apple.com/documentation/appkit/nstextview). The ``TextView`` exported by this library is designed to lay out documents made up of lines of text. It also does not attempt to reason about the contents of the document. If you're looking to edit *source code* (indentation, syntax highlighting) consider using the parent library [CodeEditSourceEditor](https://github.com/CodeEditApp/CodeEditSourceEditor).\n\n## Documentation\n\nThis package is fully documented [here](https://codeeditapp.github.io/CodeEditTextView/documentation/codeedittextview/).\n\n## Usage\n\nThis package exports a primary `TextView` class. The `TextView` class is an `NSView` subclass that can be embedded in a scroll view or used standalone. It parses and renders lines of a document and handles mouse and keyboard events for text editing. It also renders styled strings for use cases like syntax highlighting.\n\n```swift\nimport CodeEditTextView\nimport AppKit\n\n/// # ViewController\n/// \n/// An example view controller for displaying a text view embedded in a scroll view.\nclass ViewController: NSViewController, TextViewDelegate {\n    private var scrollView: NSScrollView!\n    private var textView: TextView!\n    \n    var text: String = \"func helloWorld() {\\n\\tprint(\\\"hello world\\\")\\n}\"\n    var font: NSFont!\n    var textColor: NSColor!\n    \n    override func loadView() {\n\t\ttextView = TextView(\n            string: text,\n            font: font,\n            textColor: textColor,\n            lineHeightMultiplier: 1.0,\n            wrapLines: true,\n            isEditable: true,\n            isSelectable: true,\n            letterSpacing: 1.0,\n            delegate: self\n        )\n        textView.translatesAutoresizingMaskIntoConstraints = false\n\n        scrollView = NSScrollView()\n        scrollView.translatesAutoresizingMaskIntoConstraints = false\n        scrollView.hasVerticalScroller = true\n        scrollView.hasHorizontalScroller = true\n        scrollView.documentView = textView\n        self.view = scrollView\n\t\tNSLayoutConstraint.activate([\n            scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),\n            scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor),\n            scrollView.topAnchor.constraint(equalTo: view.topAnchor),\n            scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor)\n        ])\n\n        textView.updateFrameIfNeeded()\n    }\n}\n```\n\n## License\n\nLicensed under the [MIT license](https://github.com/CodeEditApp/CodeEdit/blob/main/LICENSE.md).\n\n## Dependencies\n\nSpecial thanks to [Matt Massicotte](https://twitter.com/mattie) for the great work he's done!\n\n| Package     | Source                                               | Author                                        |\n| :---------- | :--------------------------------------------------- | :-------------------------------------------- |\n| `TextStory` | [GitHub](https://github.com/ChimeHQ/TextStory) | [Matt Massicotte](https://twitter.com/mattie) |\n| `swift-collections` | [GitHub](https://github.com/apple/swift-collections.git) | [Apple](https://github.com/apple) |\n\n## Related Repositories\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"https://github.com/CodeEditApp/CodeEdit\"\u003e\n        \u003cimg src=\"https://user-images.githubusercontent.com/806104/163099605-4eaedd33-8441-4125-9ca1-a7ccb2f62a74.png\" height=\"128\"\u003e\n        \u003cp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;CodeEdit\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/p\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"https://github.com/CodeEditApp/CodeEditSourceEditor\"\u003e\n        \u003cimg src=\"https://github.com/CodeEditApp/CodeEditTextView/blob/main/.github/CodeEditSourceEditor-Icon-128@2x.png?raw=true\" height=\"128\"\u003e\n      \u003c/a\u003e\n      \u003cp\u003e\u003ca href=\"https://github.com/CodeEditApp/CodeEditSourceEditor\"\u003eCodeEditSourceEditor\u003c/a\u003e\u003c/p\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"https://github.com/CodeEditApp/CodeEditKit\"\u003e\n        \u003cimg src=\"https://user-images.githubusercontent.com/806104/193877051-c60d255d-0b6a-408c-bb21-6fabc5e0e60c.png\" height=\"128\"\u003e\n        \u003cp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;CodeEditKit\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/p\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"https://github.com/CodeEditApp/CodeEditLanguages\"\u003e\n        \u003cimg src=\"https://user-images.githubusercontent.com/806104/201497920-d6aace8d-f0dc-49f6-bcd7-6a3b64cc384c.png\" height=\"128\"\u003e\n        \u003cp\u003eCodeEditLanguages\u003c/p\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"https://github.com/CodeEditApp/CodeEditCLI\"\u003e\n        \u003cimg src=\"https://user-images.githubusercontent.com/806104/205848006-f2654778-21f1-4f97-b292-32849cc1eff6.png\" height=\"128\"\u003e\n        \u003cp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;CodeEdit\u0026nbsp;CLI\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/p\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n","funding_links":[],"categories":["Swift"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCodeEditApp%2FCodeEditTextView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCodeEditApp%2FCodeEditTextView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCodeEditApp%2FCodeEditTextView/lists"}