Commit 82aeb617 authored by Ignacio Corderi's avatar Ignacio Corderi
Browse files

Improved exampled

parent da7718a8
Loading
Loading
Loading
Loading
+7 −8
Original line number Original line Diff line number Diff line
//: Playground - noun: a place where people can play
//: ## Example 1 - Hello World


import Kinetic
import Kinetic


// Connect to a device
//: First connect to a `KineticDevice` by creating a `KineticSession`
// This creates a KineticSession against a KineticDevice
let c = Kinetic.connect("localhost", port: 8123)
let c = Kinetic.connect("localhost", port: 8123)


// Write a key/value pair
//: Write a key/value pair
try c.put("hello", value: "world")
try c.put("hello", value: "world")


// Read the value back
//: Read the value back
let x = try c.get("hello")
let x = try c.get("hello")


// The Strings on the methods are just for convenience
//: The Strings on the methods are just for convenience
// the actual values are byte arrays ([UInt8])
//: the actual values are byte arrays `[UInt8]`
print("Received: \(String.fromUtf8(x.value!))")
print("Received: \(String.fromUtf8(x.value!))")
 No newline at end of file
+1 −1
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='osx' requires-full-environment='true'>
<playground version='5.0' target-platform='osx' requires-full-environment='true' display-mode='raw'>
    <timeline fileName='timeline.xctimeline'/>
    <timeline fileName='timeline.xctimeline'/>
</playground>
</playground>
 No newline at end of file