All Projects → appbaseio → appbase-swift

appbaseio / appbase-swift

Licence: Apache-2.0 license
Swift Library for appbase.io and ElasticSearch

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to appbase-swift

gatsby-wiki
Creating a Knowledgbase using Gatsby.js and React.js (see final product ->
Stars: ✭ 32 (+33.33%)
Mutual labels:  elasticsearch-client
VaporElasticsearch
A Vapor/Swift Elasticsearch client
Stars: ✭ 26 (+8.33%)
Mutual labels:  elasticsearch-client
elasticlient
C++ Elasticsearch client library
Stars: ✭ 112 (+366.67%)
Mutual labels:  elasticsearch-client
wES
wES is set of open source Java ElasticSearch client and toolkits; Compact, yet highly customizable and powerful.
Stars: ✭ 27 (+12.5%)
Mutual labels:  elasticsearch-client
elastic-crud
Simple yet elegant ElasticSearch Crud Repository.
Stars: ✭ 46 (+91.67%)
Mutual labels:  elasticsearch-client
spring-boot-starter-elasticsearchHighLevelClient
提供elasticsearch-rest-high-level-client连接池功能,同时对接spring-boot-starter
Stars: ✭ 57 (+137.5%)
Mutual labels:  elasticsearch-client
Chewy
High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
Stars: ✭ 1,749 (+7187.5%)
Mutual labels:  elasticsearch-client
Elasticsearch Hq
Monitoring and Management Web Application for ElasticSearch instances and clusters.
Stars: ✭ 4,832 (+20033.33%)
Mutual labels:  elasticsearch-client
elastic-go
A command-line tool to query the Elasticsearch REST API
Stars: ✭ 17 (-29.17%)
Mutual labels:  elasticsearch-client
snap
An Elasticsearch client for Elixir
Stars: ✭ 26 (+8.33%)
Mutual labels:  elasticsearch-client

Appbase-Swift

A Swift Client Library for building search apps. Supports appbase.io and ElasticSearch.

Table of Contents

  1. About Project
  2. Installation
  3. Quick Start
  4. Docs

About Project

This project aims to create fast responsive Swift Library, supported for IPhone and Mac apps which provides the functionality of Elastic Search to be integrated in the app.

The library provides very high performance results i.e. it provides response to user queries in milliseconds of time including the elastic search processing time.

Installation

Dynamic Framework (Simplest way)

  • Download the latest release of SwiftElasticSearch from Github and extract the zip

  • Navigate to your Xcode's project General settings (Click on the the blue icon showing your project's workspace -> General)

  • Drag the SwiftElasticSearch.xcodeproj file from the extracted folder in the Embedded Binaries section and select the Copy items if needed checkbox in the prompted dialog box (if it appears) and click Finish

  • Go to Linked Frameworks and Libraries section and click on the + icon

  • Click on the SwiftElasticSearch.framework to add it to dependencies

  • Build the project

Here is the GIF showing all the above steps in action -

Demo GIF

Carthage

Carthage is a decentralized dependency manager that builds dependencies and provides binary frameworks for direct use.

To install Carthage, use Homebrew package manager and write the following commands :

$ brew update
$ brew install carthage

To integrate SwiftElasticSearch in your Xcode project :

  • Switch to your project directory in terminal

  • Now make a Cartfile using command :

touch Cartfile
  • Now open the Cartfile using command :
open Cartfile
  • Add the following dependency in your Cartfile :
github "appbaseio-apps/SwiftElasticSearch" ~> <Release Version>

The current latest Release Version is 0.1.0

  • Run carthage update to build the framework

  • Drag the SwiftElasticSearch.framework file that is generated inside Build folder of Carthage to your Xcode project

  • Build the project

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but ElasticSwift does support its use on supported platforms.

To add SwiftElasticSearch library as dependency, add the following line in the dependencies value of Package.swift :

dependencies: [
.Package(url: "https://github.com/harsh-2711/SwiftElasticSearch.git", "0.1.0")
]

Quick Start

Working code example. Please note that each step is dependent on previous step.

Step 1: Import library and initiate the SwiftElasticSearch client

import SwiftElasticSearch

// app and authentication configurations
let HOST_URL = "https://scalr.api.appbase.io"
let APPNAME = "SwiftClientES"
let CREDENTIALS = "9MrI8sWhQ:7cf68f3b-51f7-45c0-973f-f3e85ad10f4b"

let client = Client.init(url: HOST_URL, app: APPNAME, credentials: CREDENTIALS)

Step 2: Add some data into the app

// Index some movie names

client.index(type: "SwiftClientES", id: "movie1", body: ["title" : "Iron Man"]) { (json, response, error) in
  // json - provides recieved JSON body
  // response - provides the received response from the server
  // error - provides the error encountered if any

  print(json!)
}

Console Output

{
    "_id" = movie1;
    "_index" = SwiftClientES;
    "_shards" =     {
        failed = 0;
        successful = 2;
        total = 2;
    };
    "_type" = SwiftClientES;
    "_version" = 2;
    created = 0;
    result = updated;
}

Step 3: Get the posted data

client.get(type: "SwiftClientES", id: "movie1") { (json, response, error) in
    print(json!)
}

Console output

{
    "_id" = movie1;
    "_index" = SwiftClientES;
    "_source" =     {
        title = "Iron Man";
    };
    "_type" = SwiftClientES;
    "_version" = 2;
    found = 1;
}

Docs

The documentation of SwiftElasticSearch library is made with the help of Jazzy library. For contributing to the documentation of this library, follow the given steps:

  • Make the necessary changes in the inline code comments
  • If you haven't, install jazzy library by typing the following command in the terminal:
[sudo] gem install jazzy
  • After installing, navigate to the project directory and type the following to generate the docs.
jazzy

For more functionalities like skipping specific files or folders, refer to documentation of the Jazzy library:

  • Now add and commit the changes and then submit a pull request :-)

Hosted docs of SwiftElasticSearch library are available at https://swift-elasticsearch.netlify.com

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].