Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLeif authored Aug 8, 2024
1 parent ab02669 commit 5c656ef
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Later

`Later` is a lightweight Swift 6 library designed to simplify asynchronous programming by providing foundational building blocks such as `Future`, `Deferred`, `Stream`, and `Publisher`. These components enable you to manage and coordinate asynchronous tasks, making it easier to write clean and maintainable code.
`Later` is a lightweight Swift 6 library designed to simplify asynchronous programming by providing foundational building blocks such as `Future`, `Deferred`, `Stream`, `SendableValue`, and `Publisher`. These components enable you to manage and coordinate asynchronous tasks, making it easier to write clean and maintainable code.

## Features

Expand All @@ -9,6 +9,7 @@
- **Stream**: Represents an asynchronous sequence of values emitted over time.
- **Publisher**: Allows objects to subscribe to changes in state or data and notifies subscribers when the state or data changes.
- **Subscribing**: A protocol for objects that want to observe changes in state or data.
- **SendableValue**: A generic [`Sendable`](https://developer.apple.com/documentation/swift/sendable) value that uses [`OSAllocatedUnfairLock`](https://developer.apple.com/documentation/os/osallocatedunfairlock).

## Installation

Expand Down Expand Up @@ -217,6 +218,19 @@ do {
}
```

### SendableValue

SendableValue is a thread-safe wrapper for a value that can be safely shared across concurrent tasks. It allows you to set and retrieve the value asynchronously.

```swift
let sendableValue = SendableValue<Int>(42)
sendableValue.set(value: 100)
let value = await sendableValue.value
#expect(value == 100)
```

This ensures that the value is safely managed across different contexts, providing a simple way to handle mutable state in concurrent programming.

## Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue if you have any suggestions or bug reports. Please create an issue before submitting any pull request to make sure the work isn’t already being worked on by someone else.

0 comments on commit 5c656ef

Please sign in to comment.