目录
目录README.md

Atomic

Atomic is a lightweight property wrapper that guarantees thread-safe access to properties decorated with the @Atomic attribute.

Usage

class Task {
    @Atomic var title: String

    init(title: String) {
        $title = Atomic(title)
    }
}

let task = Task(title: "Buy groceries")

DispatchQueue.global().async { task.title = "Buy flowers" }
DispatchQueue.global().async { task.title = "Clean kitchen" }

Installation

Swift Package Manager

To use Atomic with the Swift Package Manager, add a dependency to your Package.swift file:

let package = Package(
    dependencies: [
        .package(url: "https://github.com/shareup/atomic.git", .upToNextMajor(from: "1.0.0"))
    ]
)

Linux is not currently supported

关于
46.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号