{"id":23988851,"url":"https://github.com/philip-bui/as-you-type-formatter","last_synced_at":"2025-04-14T12:20:19.754Z","repository":{"id":56902395,"uuid":"170983071","full_name":"philip-bui/as-you-type-formatter","owner":"philip-bui","description":"Format text or behaviours as you type in constant time, given certain character prefixes such as # and @.","archived":false,"fork":false,"pushed_at":"2019-03-30T05:51:56.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-14T19:31:03.449Z","etag":null,"topics":["character-prefixes","hashtags","ios","mentions","suggestions","text-formatting"],"latest_commit_sha":null,"homepage":"","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/philip-bui.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":"2019-02-16T08:57:24.000Z","updated_at":"2024-02-20T11:51:13.000Z","dependencies_parsed_at":"2022-08-20T18:10:10.590Z","dependency_job_id":null,"html_url":"https://github.com/philip-bui/as-you-type-formatter","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philip-bui%2Fas-you-type-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philip-bui%2Fas-you-type-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philip-bui%2Fas-you-type-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philip-bui%2Fas-you-type-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philip-bui","download_url":"https://codeload.github.com/philip-bui/as-you-type-formatter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248550624,"owners_count":21122932,"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":["character-prefixes","hashtags","ios","mentions","suggestions","text-formatting"],"created_at":"2025-01-07T16:18:26.844Z","updated_at":"2025-04-14T12:20:19.709Z","avatar_url":"https://github.com/philip-bui.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# As You Type Formatter\n[![CI Status](http://img.shields.io/travis/philip-bui/as-you-type-formatter.svg?style=flat)](https://travis-ci.org/philip-bui/as-you-type-formatter)\n[![Version](https://img.shields.io/cocoapods/v/AsYouTypeFormatter.svg?style=flat)](http://cocoapods.org/pods/AsYouTypeFormatter)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Platform](https://img.shields.io/cocoapods/p/AsYouTypeFormatter.svg?style=flat)](http://cocoapods.org/pods/AsYouTypeFormatter)\n[![License](https://img.shields.io/cocoapods/l/AsYouTypeFormatter.svg?style=flat)](https://github.com/philip-bui/as-you-type-formatter/blob/master/LICENSE)\n\nAs You Type Formatter. By assuming text is always in a state of correctness, this library aims to make the minimal amount of state changes; only overriding the text change process when multiple text attributes are needed or existing text needs to be changed.\n\n- Performant - `O(newText.count + nextWord.count)` worst case.\n- Customization - Provide own character prefixes and formats.\n- Suggestions - Detects when customized words has been selected, and methods to replace these words.\n- Delegate - Methods to detect when different text formats are in use, and new suggestions are required.\n\n## Requirements\n\n- iOS 8.0+ / tvOS 9.0+ \n- Xcode 10.3+\n- Swift 4.2+\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate AsYouTypeFormatter into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'AsYouTypeFormatter'\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate AsYouTypeFormatter into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"philip-bui/as-you-type-formatter\"\n```\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but AsYouTypeFormatter does support its use on supported platforms.\n\nOnce you have your Swift package set up, adding AsYouTypeFormatter as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/philip-bui/as-you-type-formatter.git\", from: \"1.1.0\"))\n]\n```\n\n## Usage\n\n- Character Prefix. Default `#` `@`, words beginning with character prefixes use their assigned text attributes.\n\n- Delimiters. Default emojis and non-alphanumeric characters, delimiters indicate when a word has ended to use normal text attributes.\n\nAsYouTypeFormatter overrides two `UITextView` methods, `textView(shouldChangeTextIn:text:)` and `textViewDidChangeSelection()`. You can delegate your `UITextView` or call the methods within your own delegate.\n\n```swift\nimport AsYouTypeFormatter\n\n// AppDelegate.swift - Modify global defaults.\nAsYouTypeFormatter.normalAttributes = [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)]\nAsYouTypeFormatter.tagAttributes = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 16)]\nAsYouTypeFormatter.mentionAttributes = [NSAttributedString.Key.font: UIFont.italicSystemFont(ofSize: 16)]\n\n// ViewController.swift - Customize own character prefixes and formats.\nprivate lazy var typeFormatter: AsYouTypeFormatter = {\n    // Implicit return.\n    AsYouTypeFormatter(delegate: self, attributes: [\n\t\"#\": [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 16)],\n\tnil: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16)]\n    ])\n}()\n```\n \n## Design Decisions\n\n- Default Delimiters. The default delimiters are Emojis, and characters not in Unicode Category L* or 0-9. Delegate methods can customize this.\n- No suggestion support for `UITextField`. Suggestion support replies on detecting when the user selects a new word, and `UITextFieldDelegate` doesn't expose text selection events.\n- Link supports. Enabling selectable and clickable text is not very practical.\n- On multi-text selection, suggestions are disabled. The assumption is that text is usually selected when the user wants to copy and paste.\n\n## License\n\nAsYouTypeFormatter is available under the MIT license. [See LICENSE](https://github.com/philip-bui/as-you-type-formatter/blob/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilip-bui%2Fas-you-type-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilip-bui%2Fas-you-type-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilip-bui%2Fas-you-type-formatter/lists"}