Skip to content

ApiliumCode/aingle-sdk-swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AIngle SDK for Swift

Official Swift SDK for AIngle - the ultra-light distributed ledger for IoT devices.

Installation

Swift Package Manager

Add to your Package.swift:

dependencies: [
    .package(url: "https://github.com/ApiliumCode/aingle-sdk-swift.git", from: "0.1.0")
]

Or in Xcode: File → Add Packages → Enter URL:

https://github.com/ApiliumCode/aingle-sdk-swift.git

Quick Start

import AIngleSDK

// Create client
let client = AIngleClient()

// Create an entry
let hash = try await client.createEntry([
    "type": "sensor_reading",
    "value": 23.5,
    "unit": "celsius"
])
print("Created entry: \(hash)")

// Retrieve an entry
if let entry = try await client.getEntry(hash: hash) {
    print("Entry: \(entry)")
}

// Get node info
let info = try await client.getNodeInfo()
print("Node version: \(info.version)")

Subscribe to Real-time Updates

import AIngleSDK

let client = AIngleClient()

// Subscribe to updates
for await entry in client.subscribe() {
    print("New entry: \(entry.hash)")
}

API Reference

AIngleClient

Method Description
createEntry(_:) Create a new entry
getEntry(hash:) Retrieve an entry by hash
getNodeInfo() Get node information
subscribe() Subscribe to real-time updates
close() Close the client

Configuration

let config = AIngleClientConfig(
    nodeURL: URL(string: "http://localhost:8080")!,
    wsURL: URL(string: "ws://localhost:8081")!,
    timeout: 30,
    debug: false
)
let client = AIngleClient(config: config)

Platform Support

Platform Minimum Version
iOS 15.0
macOS 12.0
tvOS 15.0
watchOS 8.0

Development

# Build
swift build

# Run tests
swift test

# Generate Xcode project
swift package generate-xcodeproj

License

Apache-2.0 - see LICENSE

Links

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages