Swiftpack.co - Package - heroiclabs/nakama-swift

Nakama Swift

Swift client for Nakama server.

Nakama is an open-source distributed server for social and realtime games and apps. For more information have a look at the documentation.

This client implements the protocol and all features available in the server. It is compatible with Swift 3.1+.

If you encounter any issues with the server you can generate diagnostics for us with the doctor subcommand. Send these to support@heroiclabs.com or open an issue. If you experience any issues with the client, it can be useful to enable trace to produce detailed logs and open an issue.


If your project uses Cocoapods, add the client as a dependency to your "Podfile":

pod 'Nakama', '~> 0.3'

You can use the Swift package manager to add the code as a dependency for your project. Add the client as a dependency to your "Package.swift" file.

let package = Package(
  // ...
  dependencies: [
    .Package(url: "https://github.com/heroiclabs/nakama-swift.git", Version(0,3,0)),

We have a guide which covers how to use the client with lots of code examples:


To create a client which can connect to the Nakama server with the default settings.

import Nakama

public class NakamaSessionManager {
  private let client: Client;

  init() {
    client = Builder("defaultkey")


To build the codebase you will need to install these dependencies:

  • Swift 3.1+
  • XCode 8.3+

You must clone the repository and can (optionally) generate updated protocol buffers definitions if needed.

$> git clone git@github.com:heroiclabs/nakama-swift.git --recursive
$> swift package fetch
$> cd .build/checkouts/swift-protobuf.git--7219529775138357838/
$> swift build -c release -Xswiftc -static-stdlib
$> cd ../../..
$> protoc --plugin=./.build/checkouts/swift-protobuf.git--7219529775138357838/.build/release/protoc-gen-swift --swift_out=Sources/Nakama/. server/server/api.proto
$> mv Sources/Nakama/server/server/api.pb.swift Sources/Nakama/Server.Api.pb.swift
$> swift package generate-xcodeproj


With the codebase setup you can build and test.

$> swift build
$> swift test

To generate documentation, you'll need to install jazzy:

[sudo] gem install jazzy

Then invoke Jazzy like the following:

jazzy \
  --clean \
  --author "Heroic Labs" \
  --author_url "https://heroiclabs.com" \
  --github_url "https://github.com/heroiclabs/nakama-swift" \
  --github-file-prefix "https://github.com/heroiclabs/nakama-swift/tree/master" \
  --root-url "https://heroiclabs.github.io/nakama-swift/" \
  --xcodebuild-arguments -project,"$(pwd)/Nakama.xcodeproj",-scheme,Nakama-Package \
  --readme "$(pwd)/README.md" \
  --module "Nakama" \
  --source-directory "Sources/Nakama" \
  --output docs/ \
  --theme fullwidth


Stars: 12
Help us keep the lights on

Used By

Total: 0


v0.3.0 - Nov 8, 2017

Notable changes

This version requires Nakama server v1.2.0 or greater.


  • Consistently use strings for all Data and UUID types.

v0.2.0 - Nov 7, 2017

Notable changes


  • Add support for Friends, Groups, Chat, Notifications and Leaderboards.

v0.1.2 - Nov 7, 2017

Notable changes


  • Improve Client builder access.

v0.1.1 - Nov 7, 2017

Notable changes

  • Compatible with Swift 4.0.
  • Compatible with Nakama 1.1.0.


  • Added Carthage and Cocoapods support.

v0.1.0 - Aug 22, 2017

Notable changes


  • Initial public release.