An IPFS client/api Swift Package, with the ability to add and pin any data on iOS/iPadOS/macOS

Overview

IPFSKit

Travis CI Build Swift 5.3 xcode-version

Based on: https://github.com/ipfs-shipyard/swift-ipfs-http-client Converted into a standalone Swift Package.

Installation

Add this repo link as a swift package to your XCode project.

Requirements

- iOS 12 or later
- macOS BigSur or later

Usage

import IPFSKit

let client: IPFSClient?
    
public init() {
    client = try? IPFSClient.init(host: "ipfs.infura.io", port: 5001, ssl: true)
}

Adding data to IPFS

if let data = result.data.pngData() {
    do {
        try state.service.client?.add(data) { nodes in // Adding data to IPFS
            // use 'nodes' to pin content
        }
    } catch let error {
        GraniteLogger.info("error adding new image:\n\(error)", .expedition, focus: true)
    }
}

Convert any type of object into a Data type to prepare for adding.

Pinning data to IPFS

do {
    if let addHash = nodes.first?.hash { // the `nodes` from the closure of the previous code example
        try client?.pin.add(addHash) { pinHash in
            let gatewayHash = b58String(pinHash) // IPFS public hash gateway for the pinned content
        }
    }
} catch let error {
    GraniteLogger.info("error pinning:\n\(error)", .expedition, focus: true)
}
You might also like...
Alfred Workflow to be used with Wooshy, that brings any macOS windows to the foreground

Wooshy: Window to the Foreground! Switch apps with Alfred. Switch app windows with Wooshy: Window to the Foreground! ScreenFlow.mp4 Why Aren't you ann

A web API client in Swift built using Async/Await

Web API Client A modern web API client in Swift built using Async/Await and Actors. let client = APIClient(host: "api.github.com") // Using the clien

Pexels API client library for the Swift programming language.
Pexels API client library for the Swift programming language.

Pexels-Swift Pexels.com API client library for the Swift programming language. Overview This Swift Package is a wrapper for Pexels API to get access t

A macOS application for accessing the output of the SimpleAnalytics package on the desktop.
A macOS application for accessing the output of the SimpleAnalytics package on the desktop.

The SimpleAnalytics package allows you to collect data user interaction analytic data in iOS and macOS applications. This SimpleAnalytics Reader app project allows you to more easily make sense of that collected data by displaying it on your Mac.

Test application that gets its data from the themoviedb api

SWorld app Aplicacion de prueba que obtiene sus datos de la api themoviedb, se permite listar, buscar por titulos y acceder al detalle Prerquisitos pa

A native iOS UI widget for adding Spokestack to any iOS app.
A native iOS UI widget for adding Spokestack to any iOS app.

A native iOS library for adding Spokestack to any iOS app. Installation Edit Podfile CocoaPods is a dependency manager for Cocoa projects. For usage a

A Swift package that provides convenient Lorem Ipsum text, images, colors and other placeholders for rapidly prototyping, building and testing your iOS applications.
A Swift package that provides convenient Lorem Ipsum text, images, colors and other placeholders for rapidly prototyping, building and testing your iOS applications.

Lorem Introducing Lorem, a placeholder generator library for iOS to help you rapidly prototype, build and test your iOS applications. By leveraging Sw

Static Native Template and Dynamic Styling without any other app release

FileManager Project Students and Freshers, Good opportunity for you to learn and contribute in this project. Here you would learn how you can change t

Calculate your tip and split the bill between any number of people
Calculate your tip and split the bill between any number of people

Calculate your tip and split the bill between any number of people

Comments
  • Download uploaded image

    Download uploaded image

    In my SwiftUI App i have managed to upload images to ipfs server but cannot able to download as per the method change from get to post. Is there any workaround? Do let me know. Thanks

    opened by nick70007 1
Owner
Kala
Kala
a playground app using `MultipeerConnectivity` to transfor data wirelessly between iOS / iPadOS

README An example app using MultipeerConnectivity to transfor data wirelessly between iOS / iPadOS. Both using Data and Stream to transfer data are su

null 3 Aug 6, 2022
The Outline Client is a cross-platform VPN or proxy client for Windows, macOS, iOS, Android, and ChromeOS

Outline Client The Outline Client is a cross-platform VPN or proxy client for Windows, macOS, iOS, Android, and ChromeOS. The Outline Client is design

Jigsaw 7.3k Dec 31, 2022
Multiple Arcade Machine Emulator for iOS, iPadOS, tvOS, macOS (Catalyst)

MAME4iOS Original Author: David Valdeita (Seleuco) This is a port of MAME for iOS, iPadOS, tvOS and macOS. MAME4iOS is designed to run for modern iOS

null 438 Jan 4, 2023
Tutorials from sparrowcode.io website. You can add new, translate or fix typos. Also you can add your apps from App Store for free.

Tutorials from sparrowcode.io website. You can add new, translate or fix typos. Also you can add your apps from App Store for free.

Sparrow Code 31 Jan 3, 2023
Tutorials from sparrowcode.io website. You can add new, translate or fix typos. Also you can add your apps from App Store for free.

Страницы доступны на sparrowcode.io/en & sparrowcode.io/ru Как добавить свое приложение Добавьте элемент в json /ru/apps/apps.json. Если ваше приложен

Sparrow Code 30 Nov 25, 2022
Github iOS Client based on Github REST V3 API and GraphQL V4 API

ZLGithubClient Github iOS 客户端 by Existorlive Objective-c 2.0 Swift 5 Cocoapods 1.9.1 iOS >= 11.0 基于 Github REST V3 API 和 Github GraphQL V4 API 开发的iOS客

朱猛 55 Dec 29, 2022
FlutterNativeDragAndDrop - A package that allows you to add native drag and drop support into your flutter app

native_drag_n_drop A package that allows you to add native drag and drop support

Alex Rabin 21 Dec 21, 2022
Free and open source manga reader for iOS and iPadOS.

Aidoku A free and open source manga reading application for iOS and iPadOS. Features Ad free Robust WASM source system Online reading through external

null 421 Jan 2, 2023
Gesture Control for Safari on iOS and iPadOS

Svadilfari Svadilfari brings Gesture Control for Safari on iPhone/iPad. Features Control Safari with Gestures 10+ Customizable Actions Select Patterns

Shun Kashiwa 52 Dec 13, 2022
Stay - a local userscript manager and an extension sample for Safari on iOS/iPadOS

Stay - a local userscript manager and an extension sample for Safari on iOS/iPadOS

shen yin 688 Dec 28, 2022