Swiftpack.co - cjwcommuny/AtomicReferenceCell as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by cjwcommuny.
cjwcommuny/AtomicReferenceCell 0.1.0
AtomicReferenceCell (Arc) for Swift
⭐️ 0
🕓 2 years ago
.package(url: "https://github.com/cjwcommuny/AtomicReferenceCell.git", from: "0.1.0")

Atomic Reference Cell

This project provides two data structures: Arc<T> and WeakArc<T> for Swift.

Usage

Dereference:

let x: Arc<Int> = Arc(1)
let y: Arc<Int> = Arc(2)
let z: Int = *x + *y
assert(z == 3)

To invoke a method:

let x: Arc<Int> = Arc(1)
let y = (*x).distance(to: 3)
assert(y == 2)

To make weak reference:

let x: Arc<Int> = Arc(1)
let y: WeakArc<Int> = x.weak()
let z: Int? = *y
assert(z == 1)

Installation

SwiftPM:

.package(url: "https://github.com/cjwcommuny/AtomicReferenceCell", from: "0.1.0")

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

0.1.0
2 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics