Coder Social home page Coder Social logo

softmotions / ejdb2swift Goto Github PK

View Code? Open in Web Editor NEW
2.0 5.0 1.0 1.17 MB

EJDB2 Swift binding for iOS OSX Linux

Home Page: https://ejdb.org

License: MIT License

Swift 90.54% C 1.12% Shell 3.96% Ruby 4.37%
ejdb2 ejdb ios ios-swift swift mobile database binding bindings json cocoapods cocoapod carthage carthage-installation osx swift-binding swift-package

ejdb2swift's Introduction

EJDB2Swift

EJDB2 Swift language binding

https://github.com/Softmotions/EJDB2Swift

  • OSX
  • iOS
  • Linux
import EJDB2

let db = try EJDB2Builder("example.db").withTruncate().open()

var id = try db.put("parrots", ["name": "Bianca", "age": 4])
print("Bianca record: \(id)")

id = try db.put("parrots", ["name": "Darko", "age": 8])
print("Bianca record: \(id)")

try db.createQuery("@parrots/[age > :?]").setInt64(0, 3).list().forEach({
  print("Found \($0)")
})

try? db.close()

Code examples:

OSX / Linux

Prerequisites

Setup

On OSX/Linux EJDB2 available as package for Swift package manager

In order to use swift binding you should install system wide libejdb2 library with pkgconfig supplied.

On linux it can be accomplished by installing Debian ejdb2 package from ppa:adamansky/ejdb2

On OSX

brew install ejdb

In another case you can build it manually with cmake

git clone https://github.com/Softmotions/ejdb
cd ./ejdb
git submodule update --init

mkdir ./build && cd ./build
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_HTTP=ON
make
sudo make install

Check all is ok:

git clone https://github.com/Softmotions/EJDB2Swift
cd ./EJDB2Swift

swift test

Now you are able to use swift binding on OSX/Linux.

iOS

iOS Prerequisites

  • cmake
  • XCode

Checkout example todo-list app https://github.com/Softmotions/EJDB2IOSExample

iOS Carthage

  1. Create Cartfile with the following content
    github "Softmotions/EJDB2Swift"
    
  2. Open your project XCode settings, navigate to: Build settings of your target then set
    • Header search paths to $(PROJECT_DIR)/Carthage/Checkouts/EJDB2Swift/include
    • Framework search paths to $(PROJECT_DIR)/Carthage/Build/iOS
  3. Run carthage update --verbose
  4. Then follow usual carthage project setup instructions.

Sample EJDB2 iOS app with Carthage

iOS Cocoapods

Setup Podfile like this:

platform :ios, '9.0'

target 'EJDB2ExampleApp' do
  use_frameworks!
  pod "EJDB2"
end
pod install --verbose

Initial build takes some time - be patient

Sample EJDB2 iOS app with Cocoapods

ejdb2swift's People

Contributors

abs0 avatar adamansky avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

abs0

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.