-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Swift6.0): Introduce Sendable APIs
- Loading branch information
1 parent
1c9e08e
commit be2fd3a
Showing
8 changed files
with
1,237 additions
and
736 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// swift-tools-version:6.0 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "swift-capture", | ||
products: [ | ||
.library( | ||
name: "Capture", | ||
targets: ["Capture"] | ||
) | ||
], | ||
dependencies: [ | ||
.package( | ||
url: "https://github.com/apple/swift-docc-plugin.git", | ||
from: "1.4.0" | ||
), | ||
], | ||
targets: [ | ||
.target(name: "Capture"), | ||
.testTarget( | ||
name: "CaptureTests", | ||
dependencies: [ | ||
.target(name: "Capture") | ||
] | ||
), | ||
], | ||
swiftLanguageModes: [.v6] | ||
) | ||
|
||
for target in package.targets where target.type == .system || target.type == .test { | ||
target.swiftSettings?.append(contentsOf: [ | ||
.swiftLanguageMode(.v5), | ||
.enableExperimentalFeature("StrictConcurrency"), | ||
.enableUpcomingFeature("InferSendableFromCaptures"), | ||
]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# swift-capture | ||
|
||
[![test](https://github.com/CaptureContext/swift-capture/actions/workflows/Test.yml/badge.svg)](https://github.com/CaptureContext/swift-capture/actions/workflows/Test.yml) [![SwiftPM 5.9](https://img.shields.io/badge/📦_swiftpm-5.9-ED523F.svg?style=flat)](https://github.com/CaptureContext/swift-declarative-configuration/actions/workflows/Test.yml) ![Platforms](https://img.shields.io/badge/platforms-iOS_|_macOS_|_tvOS_|_watchOS_|_Catalyst-ED523F.svg?style=flat) | ||
[![test](https://github.com/CaptureContext/swift-capture/actions/workflows/Test.yml/badge.svg)](https://github.com/CaptureContext/swift-capture/actions/workflows/Test.yml) ![SwiftPM 5.9](https://img.shields.io/badge/📦_swiftpm-5.9_|_6.0-ED523F.svg?style=flat) ![Platforms](https://img.shields.io/badge/platforms-iOS_|_macOS_|_tvOS_|_watchOS_|_Catalyst-ED523F.svg?style=flat) | ||
[![docs](https://img.shields.io/badge/docs-spi-ED523F.svg?style=flat)]([https://twitter.com/capture_context](https://swiftpackageindex.com/CaptureContext/swift-capture/3.0.1/documentation)) [![@capture_context](https://img.shields.io/badge/contact-@capture__context-1DA1F2.svg?style=flat&logo=twitter)](https://twitter.com/capture_context) | ||
|
||
A mechanism for ergonomic and safe capturing & weakifying objects in Swift. | ||
|
@@ -47,7 +47,7 @@ capture { _self, a, b, c in | |
} | ||
``` | ||
|
||
--- | ||
---- | ||
|
||
Methods | ||
|
||
|
@@ -77,6 +77,13 @@ let object.dataSource = { [weak self] in | |
let object.dataSource = capture(orReturn: [], in: \.data) | ||
``` | ||
|
||
---- | ||
|
||
Sendable closures (_beta_) | ||
|
||
> Prefix `capture` methods with an underscore to use explicit sendable closures | ||
> Tho closures should implicitly infer sendable conformance (see [Package.swift](./Package.swift#L34)) | ||
## Installation | ||
|
||
### Basic | ||
|
@@ -94,7 +101,7 @@ If you use SwiftPM for your project, you can add `weak` to your package file. Al | |
```swift | ||
.package( | ||
url: "[email protected]:capturecontext/swift-capture.git", | ||
.upToNextMajor("3.0.0") | ||
.upToNextMajor("4.0.0-beta") | ||
) | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.