Latest 1.0.1
Homepage https://github.com/eugenebokhan/Bonjour
License BSD 3-Clause
Platforms ios 12.0, osx 10.14
Authors

Bonjour is a little singleton service for easy communication with bonjour protocol supported devices.

Requirements

  • Xcode 10
  • Swift 4.2

How To Install

pod 'Bonjour'

How To Use

  • Setup delegates:

    // Add your class to delegates dictionary
    BonjourService.shared.delegates["MyDelegateClass"] = self
    
    // Remove your class from delegates when it's necessary
    BonjourService.shared.delegates.removeValue(forKey: "MyDelegateClass")
  • Start/stop broadcasting:

    // Start broadcasting
    BonjourService.shared.startBroadcasting()
    
    // Stop broadcasting
    BonjourService.shared.stopBroadcasting()
  • Implement delegate methods:
    func updateConnectionStatus(isConnected: Bool)
    func didConnect(to host: String!, port: UInt16)
    func didAcceptNewSocket()
    func socketDidDisconnect()
    func didWriteData(tag: Int)
    func didRead(data: Data, tag: Int)  
    func netServiceDidPublish(_ netService: NetService)
    func netServiceDidNotPublish(_ netService: NetService)
  • Send messages/data:

    // Send strings
    BonjourService.shared.send(message: String)
    
    // Send dictionaries
    BonjourService.shared.send(data: [AnyHashable : Any])

Author

Bonjour Eugene Bokhan

iOS Software Engineer
Twitter Github LinkedIn

License

Project’s license is based on the BSD 3-Clause.

Latest podspec

{
    "name": "Bonjour",
    "version": "1.0.1",
    "summary": "Bonjour Service for iOS and macOS.",
    "description": "Bonjour is a little singleton service for easy communication with bonjour protocol supported devices.",
    "homepage": "https://github.com/eugenebokhan/Bonjour",
    "license": {
        "type": "BSD 3-Clause",
        "file": "LICENSE"
    },
    "authors": {
        "Eugene Bokhan": "[email protected]"
    },
    "social_media_url": "http://twitter.com/eugenebokhan",
    "module_name": "Bonjour",
    "swift_version": "4.2",
    "source": {
        "git": "https://github.com/eugenebokhan/Bonjour.git"
    },
    "platforms": {
        "ios": "12.0",
        "osx": "10.14"
    },
    "source_files": "**/*.{h,m,swift}",
    "public_header_files": "Bonjour/Bonjour/GCDAsyncSocket.h",
    "preserve_paths": "Bonjour/Bonjour/module.map",
    "ios": {
        "frameworks": "UIKit"
    },
    "osx": {
        "frameworks": "AppKit"
    },
    "xcconfig": {
        "SWIFT_INCLUDE_PATHS": "$(PODS_ROOT)/Bonjour/Bonjour/Bonjour/",
        "EXPANDED_CODE_SIGN_IDENTITY": "-",
        "EXPANDED_CODE_SIGN_IDENTITY_NAME": "-"
    }
}

Pin It on Pinterest

Share This