SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
Realm(.io) of the
Mobile Database
(an introduction to Realm)
http://realm.io/
by Martin Grider
@livingtech — http://chesstris.com
Contents of the Realm
What is Realm?

Why would you use it?

Some examples (& code)

Demo: A trivia app I made with Realm

Q&A
What is
Realm?
What is
Realm?
Realm is
MAGIC!!!
modern database written for mobile
constraints
replacement for SQLite and/or Core Data
(also supports Android)
Fast & Scalable
Object-based
queries return objects & relationships
to other objects
Open Source
CocoaPod
How fast?
How? bit-packing, caching,
vectorization and a zero-
copy architecture

* Source: realm.io, though
their benchmark code is
available for download and
scrutiny.
Why
should you
use it?
Nice documentation*
Almost no boilerplate code needed
Incredibly easy to use
Cross Platform
Thread Safe
Supports encryption**
It's OMG FREE!!!
* Documentation is available in 

Objective-C or Swift
** Encryption adds ~10% overhead
General Mobile
Database Use Cases
Local Storage
Ex: grocery list, health tracker
Cache for remote data
Ex: search history, RSS reader
Pre-loaded Data
Ex: Recipe book, trivia game
Realm Use Case
Advantages
Local Storage
define your objects, save them in 3 lines of
code, from anywhere (thread independent)
Cache for remote data
instantiate objects from NSDictionary, easy
insert-or-update methods (using primary keys)
Pre-loaded Data
Realm files are small, migrating schema (making
changes to your db objects) is easy
Realm Browser
desktop app
functional
Code
Examples
Tables are Objects &
Rows are Instances
Objects are subclasses of RLMObject
Supported property types:
NSString
NSInteger, CGFloat, int, long, float, and double
BOOL or bool
NSDate
NSData
RLMObject subclasses, so you can have many-to-one
relationships.
RLMArray<X>, where X is an RLMObject subclass, so you can
have many-to-many relationships.
Class Examples
AB_Dog.h
#import <Realm/Realm.h>
@class AB_Person;
// Dog model
@interface AB_Dog : RLMObject
@property NSString *name;
@property AB_Person *owner;
@end
RLM_ARRAY_TYPE(AB_Dog)
// defines RLMArray<AB_Dog>
AB_Dog.m
#import “AB_Dog.h”
@implementation AB_Dog
@end // none needed
AB_Person.h
#import <Realm/Realm.h>
@class AB_Dog;
// Person model
@interface AB_Person : RLMObject
@property NSString *name;
@property NSDate *birthdate;
@property RLMArray<AB_Dog> *dogs;
@end
AB_Person.m
#import “AB_Person.h”
@implementation AB_Person
@end // none needed
required

for arrays
Note that realm objects ignore property
attributes — (nonatomic, strong, etc)
Optional Class
Methods
See also:
ignoredProperties, and
indexedProperties.
default values
primary key
Inserting Ojbects
write transactions
asynchronous, even
Updates
note that all changes
MUST be in a write
transaction
insert or update
(based on primary key)
DESTRUCTION!
so easy!
Querying
query using class methods
sorting is also easy!
WHERE clause is essentially
an NSPredicate string
Memory
Matters
Trivia App
DEMO
pre-loaded data
data conversion from .plist
encapsulation of Realm access
editing UI
Sources
Realm.io
Nice introduction: http://realm.io/news/introducing-realm/
Obj-C/Swift Documentation: http://realm.io/docs/cocoa/
Obj-C API: http://realm.io/docs/cocoa/0.91.1/api/
github: https://github.com/realm/realm-cocoa
NSHipster - http://nshipster.com/nspredicate/
Images*
Magic Realm: https://www.boardgamegeek.com/boardgame/22/magic-realm
Defenders of the Realm: https://www.boardgamegeek.com/boardgame/65532/
defenders-realm
Realm of Wonder: https://www.boardgamegeek.com/boardgame/162580/realm-wonder
Realm: https://www.boardgamegeek.com/boardgame/3024/realm
Realm of Heroes: https://www.boardgamegeek.com/boardgame/139401/realm-heroes
* (I make no promises that any of these games are any good.)
Martin Grider
@livingtech
blog: http://chesstris.com/
business: http://abstractpuzzle.com/
Thank you.

Mais conteúdo relacionado

Mais procurados

React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN StackTroy Miles
 
Introduction to Jquery
Introduction to Jquery Introduction to Jquery
Introduction to Jquery Tajendar Arora
 
Google App Engine With Java And Groovy
Google App Engine With Java And GroovyGoogle App Engine With Java And Groovy
Google App Engine With Java And GroovyKen Kousen
 
Beyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor ProgrammingBeyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor ProgrammingFabio Tiriticco
 
The dark side of Akka and the remedy
The dark side of Akka and the remedyThe dark side of Akka and the remedy
The dark side of Akka and the remedykrivachy
 
Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web ServersTroy Miles
 
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Knoldus Inc.
 
Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014Jose Luis Martínez
 
Intro to React
Intro to ReactIntro to React
Intro to ReactTroy Miles
 
Slick eventsourcing
Slick eventsourcingSlick eventsourcing
Slick eventsourcingAdam Warski
 
Paws - Perl AWS SDK Update - November 2015
Paws - Perl AWS SDK Update - November 2015Paws - Perl AWS SDK Update - November 2015
Paws - Perl AWS SDK Update - November 2015Jose Luis Martínez
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practicesfloydophone
 
iOS Development with RubyMotion
iOS Development with RubyMotioniOS Development with RubyMotion
iOS Development with RubyMotionInvisiblelines
 
CloudFork
CloudForkCloudFork
CloudForkESUG
 
MongoDB .local London 2019: Realm: The Secret Sauce for Better Mobile Apps
MongoDB .local London 2019: Realm: The Secret Sauce for Better Mobile AppsMongoDB .local London 2019: Realm: The Secret Sauce for Better Mobile Apps
MongoDB .local London 2019: Realm: The Secret Sauce for Better Mobile AppsMongoDB
 
Elgg solr presentation
Elgg solr presentationElgg solr presentation
Elgg solr presentationbeck24
 
Sparkling Water Applications Meetup 07.21.15
Sparkling Water Applications Meetup 07.21.15Sparkling Water Applications Meetup 07.21.15
Sparkling Water Applications Meetup 07.21.15Sri Ambati
 
React Native Evening
React Native EveningReact Native Evening
React Native EveningTroy Miles
 
Recipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendRecipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendKarsten Thoms
 

Mais procurados (20)

React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
 
Introduction to Jquery
Introduction to Jquery Introduction to Jquery
Introduction to Jquery
 
Google App Engine With Java And Groovy
Google App Engine With Java And GroovyGoogle App Engine With Java And Groovy
Google App Engine With Java And Groovy
 
Beyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor ProgrammingBeyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor Programming
 
The dark side of Akka and the remedy
The dark side of Akka and the remedyThe dark side of Akka and the remedy
The dark side of Akka and the remedy
 
Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web Servers
 
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
 
Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Slick eventsourcing
Slick eventsourcingSlick eventsourcing
Slick eventsourcing
 
Paws - Perl AWS SDK Update - November 2015
Paws - Perl AWS SDK Update - November 2015Paws - Perl AWS SDK Update - November 2015
Paws - Perl AWS SDK Update - November 2015
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practices
 
Paws - A Perl AWS SDK
Paws - A Perl AWS SDKPaws - A Perl AWS SDK
Paws - A Perl AWS SDK
 
iOS Development with RubyMotion
iOS Development with RubyMotioniOS Development with RubyMotion
iOS Development with RubyMotion
 
CloudFork
CloudForkCloudFork
CloudFork
 
MongoDB .local London 2019: Realm: The Secret Sauce for Better Mobile Apps
MongoDB .local London 2019: Realm: The Secret Sauce for Better Mobile AppsMongoDB .local London 2019: Realm: The Secret Sauce for Better Mobile Apps
MongoDB .local London 2019: Realm: The Secret Sauce for Better Mobile Apps
 
Elgg solr presentation
Elgg solr presentationElgg solr presentation
Elgg solr presentation
 
Sparkling Water Applications Meetup 07.21.15
Sparkling Water Applications Meetup 07.21.15Sparkling Water Applications Meetup 07.21.15
Sparkling Water Applications Meetup 07.21.15
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
Recipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendRecipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with Xtend
 

Semelhante a Realm of the Mobile Database: an introduction to Realm

OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQLLuca Garulli
 
Big Data, Data Lake, Fast Data - Dataserialiation-Formats
Big Data, Data Lake, Fast Data - Dataserialiation-FormatsBig Data, Data Lake, Fast Data - Dataserialiation-Formats
Big Data, Data Lake, Fast Data - Dataserialiation-FormatsGuido Schmutz
 
Corba and-java
Corba and-javaCorba and-java
Corba and-javaafreen58
 
Dynamic Language Performance
Dynamic Language PerformanceDynamic Language Performance
Dynamic Language PerformanceKevin Hazzard
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)Netcetera
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLsintelliyole
 
IPTC News in JSON AGM 2013
IPTC News in JSON AGM 2013IPTC News in JSON AGM 2013
IPTC News in JSON AGM 2013Stuart Myles
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDBBrian Ritchie
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Guillaume Laforge
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App developmentLuca Garulli
 
Terrastore - A document database for developers
Terrastore - A document database for developersTerrastore - A document database for developers
Terrastore - A document database for developersSergio Bossa
 
Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2Dimitris Kontokostas
 
Allura - an Open Source MongoDB Based Document Oriented SourceForge
Allura - an Open Source MongoDB Based Document Oriented SourceForgeAllura - an Open Source MongoDB Based Document Oriented SourceForge
Allura - an Open Source MongoDB Based Document Oriented SourceForgeRick Copeland
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Marco Gralike
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...SPTechCon
 

Semelhante a Realm of the Mobile Database: an introduction to Realm (20)

OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQL
 
Big Data, Data Lake, Fast Data - Dataserialiation-Formats
Big Data, Data Lake, Fast Data - Dataserialiation-FormatsBig Data, Data Lake, Fast Data - Dataserialiation-Formats
Big Data, Data Lake, Fast Data - Dataserialiation-Formats
 
Reversing JavaScript
Reversing JavaScriptReversing JavaScript
Reversing JavaScript
 
Corba and-java
Corba and-javaCorba and-java
Corba and-java
 
Dynamic Language Performance
Dynamic Language PerformanceDynamic Language Performance
Dynamic Language Performance
 
RealmDB for Android
RealmDB for AndroidRealmDB for Android
RealmDB for Android
 
Basic Hibernate Final
Basic Hibernate FinalBasic Hibernate Final
Basic Hibernate Final
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
REST dojo Comet
REST dojo CometREST dojo Comet
REST dojo Comet
 
IPTC News in JSON AGM 2013
IPTC News in JSON AGM 2013IPTC News in JSON AGM 2013
IPTC News in JSON AGM 2013
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDB
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App development
 
Terrastore - A document database for developers
Terrastore - A document database for developersTerrastore - A document database for developers
Terrastore - A document database for developers
 
Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2
 
Allura - an Open Source MongoDB Based Document Oriented SourceForge
Allura - an Open Source MongoDB Based Document Oriented SourceForgeAllura - an Open Source MongoDB Based Document Oriented SourceForge
Allura - an Open Source MongoDB Based Document Oriented SourceForge
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
REST easy with API Platform
REST easy with API PlatformREST easy with API Platform
REST easy with API Platform
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
 

Mais de Martin Grider

iOS Game Development With UIKit
iOS Game Development With UIKitiOS Game Development With UIKit
iOS Game Development With UIKitMartin Grider
 
Tools for Tabletop Game Design
Tools for Tabletop Game DesignTools for Tabletop Game Design
Tools for Tabletop Game DesignMartin Grider
 
An introduction to Generic Game Model
An introduction to Generic Game ModelAn introduction to Generic Game Model
An introduction to Generic Game ModelMartin Grider
 
Case Studies in Mobile Board Game Conversion
Case Studies in Mobile Board Game ConversionCase Studies in Mobile Board Game Conversion
Case Studies in Mobile Board Game ConversionMartin Grider
 

Mais de Martin Grider (8)

Game Idea A Day
Game Idea A DayGame Idea A Day
Game Idea A Day
 
iOS Game Development With UIKit
iOS Game Development With UIKitiOS Game Development With UIKit
iOS Game Development With UIKit
 
IGDA Twin Cities
IGDA Twin CitiesIGDA Twin Cities
IGDA Twin Cities
 
Tools for Tabletop Game Design
Tools for Tabletop Game DesignTools for Tabletop Game Design
Tools for Tabletop Game Design
 
An introduction to Generic Game Model
An introduction to Generic Game ModelAn introduction to Generic Game Model
An introduction to Generic Game Model
 
Case Studies in Mobile Board Game Conversion
Case Studies in Mobile Board Game ConversionCase Studies in Mobile Board Game Conversion
Case Studies in Mobile Board Game Conversion
 
Action puzzle games
Action puzzle gamesAction puzzle games
Action puzzle games
 
Mobile game design
Mobile game designMobile game design
Mobile game design
 

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Último (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Realm of the Mobile Database: an introduction to Realm

  • 1. Realm(.io) of the Mobile Database (an introduction to Realm) http://realm.io/ by Martin Grider @livingtech — http://chesstris.com
  • 2. Contents of the Realm What is Realm? Why would you use it? Some examples (& code) Demo: A trivia app I made with Realm Q&A
  • 5. modern database written for mobile constraints replacement for SQLite and/or Core Data (also supports Android) Fast & Scalable Object-based queries return objects & relationships to other objects Open Source CocoaPod
  • 6. How fast? How? bit-packing, caching, vectorization and a zero- copy architecture
 * Source: realm.io, though their benchmark code is available for download and scrutiny.
  • 8. Nice documentation* Almost no boilerplate code needed Incredibly easy to use Cross Platform Thread Safe Supports encryption** It's OMG FREE!!! * Documentation is available in 
 Objective-C or Swift ** Encryption adds ~10% overhead
  • 9. General Mobile Database Use Cases Local Storage Ex: grocery list, health tracker Cache for remote data Ex: search history, RSS reader Pre-loaded Data Ex: Recipe book, trivia game
  • 10. Realm Use Case Advantages Local Storage define your objects, save them in 3 lines of code, from anywhere (thread independent) Cache for remote data instantiate objects from NSDictionary, easy insert-or-update methods (using primary keys) Pre-loaded Data Realm files are small, migrating schema (making changes to your db objects) is easy
  • 13. Tables are Objects & Rows are Instances Objects are subclasses of RLMObject Supported property types: NSString NSInteger, CGFloat, int, long, float, and double BOOL or bool NSDate NSData RLMObject subclasses, so you can have many-to-one relationships. RLMArray<X>, where X is an RLMObject subclass, so you can have many-to-many relationships.
  • 14. Class Examples AB_Dog.h #import <Realm/Realm.h> @class AB_Person; // Dog model @interface AB_Dog : RLMObject @property NSString *name; @property AB_Person *owner; @end RLM_ARRAY_TYPE(AB_Dog) // defines RLMArray<AB_Dog> AB_Dog.m #import “AB_Dog.h” @implementation AB_Dog @end // none needed AB_Person.h #import <Realm/Realm.h> @class AB_Dog; // Person model @interface AB_Person : RLMObject @property NSString *name; @property NSDate *birthdate; @property RLMArray<AB_Dog> *dogs; @end AB_Person.m #import “AB_Person.h” @implementation AB_Person @end // none needed required
 for arrays Note that realm objects ignore property attributes — (nonatomic, strong, etc)
  • 15. Optional Class Methods See also: ignoredProperties, and indexedProperties. default values primary key
  • 17. Updates note that all changes MUST be in a write transaction insert or update (based on primary key)
  • 19. Querying query using class methods sorting is also easy! WHERE clause is essentially an NSPredicate string
  • 20. Memory Matters Trivia App DEMO pre-loaded data data conversion from .plist encapsulation of Realm access editing UI
  • 21. Sources Realm.io Nice introduction: http://realm.io/news/introducing-realm/ Obj-C/Swift Documentation: http://realm.io/docs/cocoa/ Obj-C API: http://realm.io/docs/cocoa/0.91.1/api/ github: https://github.com/realm/realm-cocoa NSHipster - http://nshipster.com/nspredicate/ Images* Magic Realm: https://www.boardgamegeek.com/boardgame/22/magic-realm Defenders of the Realm: https://www.boardgamegeek.com/boardgame/65532/ defenders-realm Realm of Wonder: https://www.boardgamegeek.com/boardgame/162580/realm-wonder Realm: https://www.boardgamegeek.com/boardgame/3024/realm Realm of Heroes: https://www.boardgamegeek.com/boardgame/139401/realm-heroes * (I make no promises that any of these games are any good.)