🚀 我们邀请开源爱好者贡献力量! 🚀
尽管暂停了更新,Ciao 仍在运行,并且可以进行改进。您的贡献可以为它注入新的活力!
您可以如何帮助
首先 fork 该仓库,创建您的功能分支,并深入研究我们的 问题。每一次贡献都是迈向进步的一步!
使用 mDNS 发布和查找服务的库
CocoaPods 是 Cocoa 项目的依赖管理器。您可以使用以下命令安装它
$ gem install cocoapods
要使用 CocoaPods 将 Ciao 集成到您的 Xcode 项目中,请在您的 Podfile
中指定它
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Ciao', '~> 2.1.2'
然后,运行以下命令
$ pod install
Carthage 是一个去中心化的依赖管理器,可以自动将框架添加到您的 Cocoa 应用程序中。
您可以使用 Homebrew 使用以下命令安装 Carthage
$ brew update
$ brew install carthage
要使用 Carthage 将 Ciao 集成到您的 Xcode 项目中,请在您的 Cartfile
中指定它
github "AlTavares/Ciao" ~> 2.1.2
要将 Ciao 用作 Swift Package Manager 包,只需在您的 Package.swift 文件中添加以下内容。
dependencies: [
.package(url: "https://github.com/AlTavares/Ciao.git", from: "2.1.2")
]
let ciaoServer = CiaoServer(type: ServiceType.tcp("ciaoserver"))
ciaoServer.start { (success) in
print("Server started:", success)
}
ciaoServer.txtRecord = ["someKey": "someValue"]
let ciaoBrowser = CiaoBrowser()
// get notified when a service is found
ciaoBrowser.serviceFoundHandler = { service in
print("Service found")
print(service)
}
// register to automatically resolve a service
ciaoBrowser.serviceResolvedHandler = { service in
print("Service resolved")
print(service)
print(service.hostName)
print(service.txtRecordDictionary)
}
ciaoBrowser.serviceRemovedHandler = { service in
print("Service removed")
print(service)
}
ciaoBrowser.browse(type: type)
您还可以选择使用解析器来解析任何 NetService 实例
var resolver = CiaoResolver(service: service)
resolver?.resolve(withTimeout: 0) { (result: Result<NetService, ErrorDictionary>) in
print(result)
}
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
Ciao 在 MIT 许可证下发布。有关详细信息,请参阅 LICENSE。