SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
‣
‣
‣
• https://github.com/iOSDevKor/StartRealm
Realm Browser
• https://itunes.apple.com/kr/app/realm-browser/
id1007457278?mt=12
16.02.03. 22:00
16.02.07. 18:30
16.02.11. 14:00
class Travel: Object {
dynamic var travelTitle: String?
dynamic var travelCreationDate: Date = Date()
let imageDatas: List<ImageData> = List<ImageData>()
}
class ImageData: Object {
dynamic var timeStamp: Int = 0
dynamic var country: String?
dynamic var city: String?
dynamic var image: Data?
}
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
import RealmSwift
class Album: Object {
dynamic var title: String = ""
dynamic var createDate: Date = Date()
let photos: List<Photo> = List<Photo>()
}
class Photo: Object {
dynamic var createDate: Date = Date()
dynamic var image: Data = Data()
}
let realm = try! Realm()
‣
‣
// configuration( )
let realm = try! Realm(configuration: realmConfig)
// Realm URL
let realm = try! Realm(fileURL: realmURL)
let realm = try! Realm() ( )
do {
let realm = try Realm()
} catch {
print(“(error)")
// handle error
}
( )
try! realm.write {
// Do something
}
‣
‣
try! Realm.write { } ( )
do {
try realm.write {
realm.add(object)
realm.delete(object)
}
} catch {
print(“(error)")
// handle error
}
( )
class {
var token: NotificationToken!
token = albums.addNotificationBlock({(change) in
// Do something
self.UIUpdate()
})
}
‣
‣
Realm.Configuration(
// schemaVersion 0 , .
schemaVersion: 3,
// schemaVerion , schema .
migrationBlock: { { migration, oldSchemaVersion in
if oldSchemaVersion < 1 {
}
if oldSchemaVersion < 2 {
}
})
‣
‣
‣
‣
‣
// schemaVersion0
class Album: Object {
dynamic var title: String = ""
dynamic var createDate: Date = Date()
let photos: List<Photos> = List<Photos>()
}
// schemaVersion1
class Album: Object {
dynamic var title: String = ""
dynamic var createDate: Date = Date()
// property
dynamic var uuid: String = UUID().uuidString
let photos: List<Photos> = List<Photos>()
}
class Album: Object {
dynamic var title: String = ""
dynamic var createDate: Date = Date()
dynamic var uuid: String = UUID().uuidString
let photos: List<Photos> = List<Photos>()
override class func primaryKey() -> String? {
return "uuid"
}
}
‣
‣
Device
‣ DB
shift+command+2 > App container >
Simulator
‣ /
Realm.Configuration.defaultConfiguration.fileURL
🤗

Weitere ähnliche Inhalte

Ähnlich wie 프알못의 Realm 사용기

demo car display.pptx
demo car display.pptxdemo car display.pptx
demo car display.pptxssuser016f54
 
An Introduction to Jquery
An Introduction to JqueryAn Introduction to Jquery
An Introduction to JqueryPhil Reither
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScriptersgerbille
 
YQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to userYQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to userTom Croucher
 
Building Apps with SwiftUI and Firebase
Building Apps with SwiftUI and FirebaseBuilding Apps with SwiftUI and Firebase
Building Apps with SwiftUI and FirebasePeter Friese
 
OSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler ParcelOSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler ParcelTed Leung
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineAndy McKay
 
Im flash
Im flashIm flash
Im flashhuanwu
 
Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Robert DeLuca
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)Katsumi Kishikawa
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLgerbille
 
HTML5 after the hype - JFokus2015
HTML5 after the hype - JFokus2015HTML5 after the hype - JFokus2015
HTML5 after the hype - JFokus2015Christian Heilmann
 
Go Mobile with Apache Cordova, Zagreb 2014
Go Mobile with Apache Cordova, Zagreb 2014Go Mobile with Apache Cordova, Zagreb 2014
Go Mobile with Apache Cordova, Zagreb 2014Christian Grobmeier
 
The Django Book CH13 Generating Non-HTML Content
The Django Book CH13 Generating Non-HTML ContentThe Django Book CH13 Generating Non-HTML Content
The Django Book CH13 Generating Non-HTML ContentJohnny Wang
 
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...Matt Spradley
 

Ähnlich wie 프알못의 Realm 사용기 (20)

demo car display.pptx
demo car display.pptxdemo car display.pptx
demo car display.pptx
 
An Introduction to Jquery
An Introduction to JqueryAn Introduction to Jquery
An Introduction to Jquery
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
 
YQL Tutorial
YQL TutorialYQL Tutorial
YQL Tutorial
 
YQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to userYQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to user
 
Building Apps with SwiftUI and Firebase
Building Apps with SwiftUI and FirebaseBuilding Apps with SwiftUI and Firebase
Building Apps with SwiftUI and Firebase
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 
OSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler ParcelOSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler Parcel
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Im flash
Im flashIm flash
Im flash
 
Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGL
 
HTML5 after the hype - JFokus2015
HTML5 after the hype - JFokus2015HTML5 after the hype - JFokus2015
HTML5 after the hype - JFokus2015
 
Go Mobile with Apache Cordova, Zagreb 2014
Go Mobile with Apache Cordova, Zagreb 2014Go Mobile with Apache Cordova, Zagreb 2014
Go Mobile with Apache Cordova, Zagreb 2014
 
Seti 09
Seti 09Seti 09
Seti 09
 
Core animation
Core animationCore animation
Core animation
 
The Django Book CH13 Generating Non-HTML Content
The Django Book CH13 Generating Non-HTML ContentThe Django Book CH13 Generating Non-HTML Content
The Django Book CH13 Generating Non-HTML Content
 
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
 
Three.js basics
Three.js basicsThree.js basics
Three.js basics
 

Mehr von Mijeong Jeon

Azure_CogSearch_OAI.pdf
Azure_CogSearch_OAI.pdfAzure_CogSearch_OAI.pdf
Azure_CogSearch_OAI.pdfMijeong Jeon
 
Performance Comparing : ONNX, TF, PyTorch
Performance Comparing : ONNX, TF, PyTorchPerformance Comparing : ONNX, TF, PyTorch
Performance Comparing : ONNX, TF, PyTorchMijeong Jeon
 
let us: Go! 2019 Summer 앱 수익으로 월세내기
let us: Go! 2019 Summer 앱 수익으로 월세내기let us: Go! 2019 Summer 앱 수익으로 월세내기
let us: Go! 2019 Summer 앱 수익으로 월세내기Mijeong Jeon
 
Azure AutoML 함께 실습하기
Azure AutoML 함께 실습하기Azure AutoML 함께 실습하기
Azure AutoML 함께 실습하기Mijeong Jeon
 
iOS 모바일에서 한글 손글씨 인식하기(with Keras)
iOS 모바일에서 한글 손글씨 인식하기(with Keras) iOS 모바일에서 한글 손글씨 인식하기(with Keras)
iOS 모바일에서 한글 손글씨 인식하기(with Keras) Mijeong Jeon
 
내 손 위의 딥러닝_iOS에 딥러닝 심기
내 손 위의 딥러닝_iOS에 딥러닝 심기 내 손 위의 딥러닝_iOS에 딥러닝 심기
내 손 위의 딥러닝_iOS에 딥러닝 심기 Mijeong Jeon
 
iOS와 케라스의 만남
iOS와 케라스의 만남iOS와 케라스의 만남
iOS와 케라스의 만남Mijeong Jeon
 
프알못의 Keras 사용기
프알못의 Keras 사용기프알못의 Keras 사용기
프알못의 Keras 사용기Mijeong Jeon
 

Mehr von Mijeong Jeon (9)

Azure_CogSearch_OAI.pdf
Azure_CogSearch_OAI.pdfAzure_CogSearch_OAI.pdf
Azure_CogSearch_OAI.pdf
 
Performance Comparing : ONNX, TF, PyTorch
Performance Comparing : ONNX, TF, PyTorchPerformance Comparing : ONNX, TF, PyTorch
Performance Comparing : ONNX, TF, PyTorch
 
let us: Go! 2019 Summer 앱 수익으로 월세내기
let us: Go! 2019 Summer 앱 수익으로 월세내기let us: Go! 2019 Summer 앱 수익으로 월세내기
let us: Go! 2019 Summer 앱 수익으로 월세내기
 
Azure AutoML 함께 실습하기
Azure AutoML 함께 실습하기Azure AutoML 함께 실습하기
Azure AutoML 함께 실습하기
 
iOS 모바일에서 한글 손글씨 인식하기(with Keras)
iOS 모바일에서 한글 손글씨 인식하기(with Keras) iOS 모바일에서 한글 손글씨 인식하기(with Keras)
iOS 모바일에서 한글 손글씨 인식하기(with Keras)
 
180825 azure ai
180825 azure ai180825 azure ai
180825 azure ai
 
내 손 위의 딥러닝_iOS에 딥러닝 심기
내 손 위의 딥러닝_iOS에 딥러닝 심기 내 손 위의 딥러닝_iOS에 딥러닝 심기
내 손 위의 딥러닝_iOS에 딥러닝 심기
 
iOS와 케라스의 만남
iOS와 케라스의 만남iOS와 케라스의 만남
iOS와 케라스의 만남
 
프알못의 Keras 사용기
프알못의 Keras 사용기프알못의 Keras 사용기
프알못의 Keras 사용기
 

Kürzlich hochgeladen

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 

Kürzlich hochgeladen (20)

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 

프알못의 Realm 사용기

  • 1.
  • 3. • https://github.com/iOSDevKor/StartRealm Realm Browser • https://itunes.apple.com/kr/app/realm-browser/ id1007457278?mt=12
  • 4.
  • 6. class Travel: Object { dynamic var travelTitle: String? dynamic var travelCreationDate: Date = Date() let imageDatas: List<ImageData> = List<ImageData>() } class ImageData: Object { dynamic var timeStamp: Int = 0 dynamic var country: String? dynamic var city: String? dynamic var image: Data? }
  • 10. import RealmSwift class Album: Object { dynamic var title: String = "" dynamic var createDate: Date = Date() let photos: List<Photo> = List<Photo>() } class Photo: Object { dynamic var createDate: Date = Date() dynamic var image: Data = Data() }
  • 11. let realm = try! Realm() ‣ ‣ // configuration( ) let realm = try! Realm(configuration: realmConfig) // Realm URL let realm = try! Realm(fileURL: realmURL)
  • 12. let realm = try! Realm() ( ) do { let realm = try Realm() } catch { print(“(error)") // handle error } ( )
  • 13. try! realm.write { // Do something } ‣ ‣
  • 14. try! Realm.write { } ( ) do { try realm.write { realm.add(object) realm.delete(object) } } catch { print(“(error)") // handle error } ( )
  • 15. class { var token: NotificationToken! token = albums.addNotificationBlock({(change) in // Do something self.UIUpdate() }) }
  • 16. ‣ ‣ Realm.Configuration( // schemaVersion 0 , . schemaVersion: 3, // schemaVerion , schema . migrationBlock: { { migration, oldSchemaVersion in if oldSchemaVersion < 1 { } if oldSchemaVersion < 2 { } })
  • 18. // schemaVersion0 class Album: Object { dynamic var title: String = "" dynamic var createDate: Date = Date() let photos: List<Photos> = List<Photos>() } // schemaVersion1 class Album: Object { dynamic var title: String = "" dynamic var createDate: Date = Date() // property dynamic var uuid: String = UUID().uuidString let photos: List<Photos> = List<Photos>() }
  • 19. class Album: Object { dynamic var title: String = "" dynamic var createDate: Date = Date() dynamic var uuid: String = UUID().uuidString let photos: List<Photos> = List<Photos>() override class func primaryKey() -> String? { return "uuid" } } ‣ ‣
  • 20. Device ‣ DB shift+command+2 > App container > Simulator ‣ / Realm.Configuration.defaultConfiguration.fileURL
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26. 🤗