Stargate 0.1.0

Stargate 0.1.0

测试测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2015年5月
SPM支持SPM

Rouven WeßlingJP Wright维护。



 
依赖项
MMWormhole~> 1.1
PeerKit~> 1.1
 

Stargate 0.1.0

从您的Mac到您的查看器之间的通信频道。

在MMWormhole和PeerKit周围提供方便的包装工具,Stargate利用多对多连接和App Group在OS X应用程序和iPhone之间的ᴡᴀᴛᴄʜ上通信,通信是双向的,并允许您发送符合NSCoding的任何对象。

用法

简单通过CocoaPods安装它

use_frameworks!

pod 'Stargate'

注意:请确保您使用的是0.37或更高版本。Stargate是用Swift 1.2编写的,因此还需要Xcode 6.3或更高版本。

在Mac上

通过多对多连接发送和接收消息

let stargate = Earth(applicationGroupIdentifier: "group.com.contentful.Stargate")

stargate.listenForMessage(identifier: "stargate2") { (object) -> Void in
    println("Received message on Mac: \(object)")
}

stargate.passMessage("YOLO", identifier: "stargate")

在手机上

在Multipeer和Darwin通知之间连接消息

let stargate = Abydos(applicationGroupIdentifier: "group.com.contentful.Stargate")

stargate.tunnel()
stargate.tunnelReplies(identifier: "stargate2")

在查看器上

通过Darwin通知发送和接收消息

let stargate = Atlantis(applicationGroupIdentifier: "group.com.contentful.Stargate")

stargate.passMessage("YOLO", identifier:"stargate2")

stargate.listenForMessage(identifier:"stargate") { (object) -> Void in
    println("Received message on watch: \(object)")
}

stargate.stopListeningForMessage(identifier:"stargate")

查看示例项目以获取如何在所有三个平台上设置单个项目的指导。在创建目标时,请确保您没有意外地将OS X目标作为WatchKit扩展的主机。

许可证

版权(c)2015 Contentful GmbH。有关详细信息,请参阅LICENSE