Fast,   Fluid,   Effective

an open source iOS ORM, designed from the start to be low maintenance and natural to use, developers choose shark for its power and simplicity.

Straight forward query language

It should seem familiar, because it's SQL.  This way you can harness all the flexibility of SQLite, but interface with real objects, using powerful concepts such as joins and subqueries to fully optimise your applications. SQLite is great at what is does, and Shark lets you use that power, whilst automatically fine tuning the data layer for fastest retrieval.

let results = Department.query()
                        .whereWithFormat("Id IN (SELECT department FROM People WHERE current = %@)",withParameters: [true])

for department in results {

let query = Person.query()
let numberOfPeople = query.count()
let peopleBySurname = query.groupBy("surname")
let totalAge = query.sumOf("age")

Very flexible interface

The query object has many parameters, you can specify where clauses, limits, offsets, batches, order by.  And once you've built the query, you can then retrieve a result set filled with normal objects, distinct column values, summed properties, counts on properties and grouped results.

Thread safe in every scenario

There isn't much to say here, we've ensured that nothing can unsettle the ORM when making calls across threads.   You can also use asynchronous queries and decide which thread gets called upon to finalise the query results.  Even if you are using a batched result set, the original thread will be used to perform subsequent queries.

dispatch_async(dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), {
   let p = Person()
   p.Name = "Adrian Herridge"
   p.age = 37


The ORM itself

  • Thread safe

  • Event models

  • Managed objects (or not)

  • Transactions

  • Full text search support

  • Column level encryption

  • Indexing



  • FLUENT interface

  • Subqueries

  • Where, limit, order by, offset

  • Joining

  • Fetch, count, sum,distinct and group operations

  • Batch operations built in

  • Low memory objects



  • Normal class objects

  • Events for before and after insert/update/delete

  • Support for most common data types

  • Objects can be passed anywhere, including across threads.

  • Objects can be part of different domains, allowing full control over how they are managed