GithubHelp home page GithubHelp logo

andrewleechch / nakama-swift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heroiclabs/nakama-swift

1.0 1.0 0.0 8.08 MB

Swift client for Nakama server.

Home Page: https://heroiclabs.com/docs/swift-ios-client-guide/

License: Apache License 2.0

Ruby 0.17% Swift 99.83%

nakama-swift's Introduction

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 4.2+.

If you encounter any issues with the server you can generate diagnostics for us with the doctor subcommand. Send these to [email protected] 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.

Usage

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

use_frameworks!
pod 'Nakama', '~> 2.0'

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(2,0,0)),
  ]
)

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

https://heroiclabs.com/docs/swift-ios-client-guide/

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")
        .host("127.0.0.1")
        .port(7350)
        .ssl(false)
        .build()
  }
}

Contribute

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

  • Swift 4.2+
  • XCode 10+

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

$> git clone [email protected]:heroiclabs/nakama-swift.git --recursive
$> swift package fetch
$> protoc -I./ -I/usr/local/include -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway --swift_out=./Sources/Nakama/2.XClient/ --swiftgrpc_out=./Sources/Nakama/2.XClient/ --plugin=grpc ./proto/api.proto
$> protoc -I./ -I/usr/local/include -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway --swift_out=./Sources/Nakama/2.XClient/ --swiftgrpc_out=./Sources/Nakama/2.XClient/ --plugin=grpc ./proto/apigrpc.proto
$> swift package generate-xcodeproj

Development

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.