【文件属性】:
文件名称:Once:Swift 中 Dispatch Once 的替代品
文件大小:20KB
文件格式:ZIP
更新时间:2021-05-29 19:54:55
c swift carthage swift-package-manager dispatch
一次
用于 Swift 的 Dispatch Once 和 pthread_once 的简单线程安全替代品。
Swift 包管理器
更新您的Package.swift以包含以下适当的依赖项:
斯威夫特 5.2+
. package ( name : " Once " , " https://github.com/bscothern/Once.git " , from : " 1.4.0 " )
斯威夫特 4.0-5.1
. package ( url : " https://github.com/bscothern/Once.git " , from : " 1.3.2 " )
迦太基用法
将此行包含在您的Cartfile :
github "bscothern/Once"
用法
import Once
let once = Once ()
func foo () {
【文件预览】:
Once-main
----.swiftlint.yml(105B)
----LICENCE(1KB)
----.github()
--------workflows()
----Sources()
--------Swift()
--------module.modulemap(229B)
--------OnceC()
--------Once.h(352B)
--------Info.plist(776B)
----Package@swift-4.swift(693B)
----Package.swift(783B)
----Once.xcodeproj()
--------project.xcworkspace()
--------project.pbxproj(41KB)
--------xcshareddata()
----.gitignore(1KB)
----Tests()
--------LinuxMain.swift(237B)
--------OnceTests()
----README.md(1KB)