Skip to content

Commit

Permalink
Modernize readme, add some missing stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Jan 22, 2024
1 parent 2e10baf commit 5ff7f33
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<div align="center">

[![Build Status][build status badge]][build status]
[![Platforms][platforms badge]][platforms]
[![Documentation][documentation badge]][documentation]
[![Discord][discord badge]][discord]

</div>

# Rearrange

Rearrange is a collection of utilities for making it easier to work with `NSRange` and `NSTextRange`. It's particularly handy when used with the Cocoa text system.
Rearrange is a collection of utilities for making it easier to work with `NSRange`, `IndexSet`, `NSTextRange`/`UITextRange`, and `NSTextLocation`.

## Integration

Expand All @@ -22,7 +27,7 @@ dependencies: [

This is a struct that encapsulates a single change to an `NSRange`. It's useful for serializing, queuing, or otherwise storing changes and applying them.

You can also use this class to tranform individual points or other `NSRange`s. This is handy for updating a set of stored `NSRange`s as text is changed. This might seem easy, but there are a large number of edge cases that `RangeMutation` handles, including mutations that invalidate (for example completely delete) a range.
You can also use this class to tranform locations, `NSRange`, or even an `IndexSet`. This is handy for updating values as text is changed. This might seem easy, but there are a large number of edge cases that `RangeMutation` handles, including mutations that invalidate (for example completely delete) a range.

## Extensions

Expand Down Expand Up @@ -69,6 +74,8 @@ convenience init?(_ range: NSRange, provider: NSTextElementProvider)
**IndexSet**

```swift
init(integersIn range: NSRange)
init(ranges: [NSRange])
mutating func insert(range: NSRange)
mutating func insert(ranges: [NSRange])
mutating func remove(integersIn range: NSRange)
Expand All @@ -80,14 +87,24 @@ var limitSpanningRange: NSRange?

**String**

```Swift
```swift
subscript(range: Range<Int>) -> Substring?
subscript(range: NSRange) -> Substring?
```

**NSTextLocation**

```swift
static func < (lhs: Self, rhs: Self) -> Bool
static func == (lhs: Self, rhs: Self) -> Bool
static func <= (lhs: Self, rhs: Self) -> Bool
static func > (lhs: Self, rhs: Self) -> Bool
static func >= (lhs: Self, rhs: Self) -> Bool
```

## Contributing and Collaboration

I'd love to hear from you! Get in touch via an issue or pull request.
I would love to hear from you! Issues, Discussions, or pull requests work great. A [Discord server][discord] is also available for live help, but I have a strong bias towards answering in the form of documentation.

I prefer collaboration, and would love to find ways to work together if you have a similar project.

Expand All @@ -101,3 +118,5 @@ By participating in this project you agree to abide by the [Contributor Code of
[platforms badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FChimeHQ%2FRearrange%2Fbadge%3Ftype%3Dplatforms
[documentation]: https://swiftpackageindex.com/ChimeHQ/Rearrange/main/documentation
[documentation badge]: https://img.shields.io/badge/Documentation-DocC-blue
[discord]: https://discord.gg/esFpX6sErJ
[discord badge]: https://img.shields.io/badge/Discord-purple?logo=Discord&label=Chat&color=%235A64EC

0 comments on commit 5ff7f33

Please sign in to comment.