Skip to content
EJDB2 Swift binding for iOS OSX Linux
Swift Ruby Shell C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
EJDB2.xcodeproj
Sources
Tests
.gitignore
EJDB2.podspec
LICENSE
Package.swift
README.md
build-ios.sh

README.md

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

You can’t perform that action at this time.