• Stars
    star
    61
  • Rank 479,954 (Top 10 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 6 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Publish and discover services using Bonjour

Ciao

Join the Ciao Project as a Contributor!

πŸš€ We're inviting open-source enthusiasts to contribute! πŸš€

Despite a pause in updates, Ciao is operational and ready for enhancements. Your contributions can breathe new life into it!

How You Can Help:

  • Code Enhancements: From minor tweaks to major features, all contributions are welcome.
  • Documentation Updates: Help keep our documentation current and user-friendly.
  • Community Engagement: Support users and enrich discussions.

Start by forking the repo, create your feature branch, and dive into our issues. Every contribution is a step towards advancement!

Platforms License

Swift Package Manager Carthage compatible CocoaPods compatible

Lib to publish and find services using mDNS

Requirements

  • iOS 8.0+ / Mac OS X 10.10+ / tvOS 9.0+
  • Xcode 9.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Ciao into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Ciao', '~> 2.1.1'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Ciao into your Xcode project using Carthage, specify it in your Cartfile:

github "AlTavares/Ciao" ~> 2.1.1

Swift Package Manager

To use Ciao as a Swift Package Manager package just add the following in your Package.swift file.

dependencies: [
    .package(url: "https://github.com/AlTavares/Ciao.git", from: "2.1.1")
]

Usage

Server

let ciaoServer = CiaoServer(type: ServiceType.tcp("ciaoserver"))

ciaoServer.start { (success) in
    print("Server started:", success)
}
ciaoServer.txtRecord = ["someKey": "someValue"]

Browser

let ciaoBrowser = CiaoBrowser()

// get notified when a service is found
browser.serviceFoundHandler = { service in
    print("Service found")
    print(service)
}

// register to automatically resolve a service
browser.serviceResolvedHandler = { service in
    print("Service resolved")
    print(service)
    print(service.hostName)
    print(service.txtRecordDictionary)
}

browser.serviceRemovedHandler = { service in
    print("Service removed")
    print(service)
}

ciaoBrowser.browse(type: type) 

Resolver

Optionally you can also use the resolver to any NetService instance

var resolver = CiaoResolver(service: service)
resolver?.resolve(withTimeout: 0) { (result: Result<NetService, ErrorDictionary>) in
    print(result)
}

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

Ciao is released under the MIT license. See LICENSE for details.