Swiftpack.co -  tgu/RosSwift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
ROS Robotic Operating System - Swift implementation of core client libraries and rosmaster. Based on roscpp.
.package(url: "https://github.com/tgu/RosSwift.git", from: "1.3.2")


ROS Robotic Operating System - Swift implementation of core client libraries. Based on roscpp.

RosSwift is a Swift implementation of ROS. It provides a Swift library based on Swift-NIO that enables Swift programmers to interface to ROS. It is tested on OSX and Linux (Raspberry Stretch, Ubuntu) and should also work on all platforms that are supported by Swift-NIO.

There are some unimplemented features, basic publishing, subscription, services and parameters should work.


Minimum SDK10.14 on OSX, also works on iOS14

Swift 5.3 on Raspberry, tested with Ubuntu 20.10

It can be necessary to allow arbitary loads in the Info.plist file for iOS and macOS



The package include msgbuilder to generate code for custom messages.


The package include roscore that is a swift implementation of the ros master. The master advertises its presense with Bonjour on Apple devices and with Avahi on Linux devices. A client initialization of Ros will search for the master unless the url is specified with remapping ros = Ros(name: "phone", remappings: ["__master":""]) or with the environment variable ROS_MASTER_URI

For service discovery in iOS14 Client app, add NSBonjourServices to your Info.plist



The following code snippet shows how to model a publisher

import Foundation
import RosSwift
import RosTime
import StdMsgs

let ros = Ros(argv: &CommandLine.arguments, name: "talker")
let n = ros.createNode()
guard let chatter_pub = n.advertise(topic: "/chatter", message: String.self) else {

var rate = Rate(frequency: 10.0)

var j : Int32 = 0
while ros.ok {
    chatter_pub.publish(message: "Hello \(j)")
    j += 1

The following code snippet shows how to model a simple listener

import RosSwift
import StdMsgs
import msgs

let ros = Ros(argv: &CommandLine.arguments, name: "listener")
let node = ros.createNode()
let imu = node.subscribe(topic: "/imu") { (msg: sensor_msgs.Imu) in
    print("accel: [\(msg.linear_acceleration)]")


Stars: 27
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API