{"id":264,"date":"2021-05-03T07:52:41","date_gmt":"2021-05-02T22:52:41","guid":{"rendered":"https:\/\/tech.for-easy-learning.com\/?p=264"},"modified":"2021-05-03T07:52:41","modified_gmt":"2021-05-02T22:52:41","slug":"%e3%80%90ios-swift%e3%80%91realm-%e3%81%a7%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e7%a2%ba%e8%aa%8d%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/tech.for-easy-learning.com\/?p=264","title":{"rendered":"\u3010iOS\/Swift\u3011Realm \u3067\u30c7\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b"},"content":{"rendered":"\n<p>iOS \u3067\u624b\u8efd\u306b\u30c7\u30fc\u30bf\u3092\u6c38\u7d9a\u5316\u3059\u308b\u5834\u5408 UserDefaults \u304c\u4e00\u822c\u7684\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u306a\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u5fc5\u9808\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u306e\u5834\u5408\u3001iOS \u304c\u5099\u3048\u3066\u3044\u308b CoreData \u304c\u59cb\u3081\u308b\u5206\u306b\u306f\u624b\u8efd\u3067\u3059\u3002\u304c\u3001\u5b9f\u969b\u306b\u958b\u767a\u3092\u59cb\u3081\u308b\u3068\u69d8\u3005\u306a\u70b9\u3067\u4e0d\u4fbf\u306a\u3053\u3068\u304c\u591a\u304f\u79c1\u3068\u3057\u3066\u306f <a href=\"https:\/\/realm.io\/\" data-type=\"URL\" data-id=\"https:\/\/realm.io\/\">Realm<\/a> \u304c\u4fbf\u5229\u3067\u3057\u3063\u304f\u308a\u304d\u307e\u3059\u3002\u4eca\u56de\u306f Realm \u3067\u5b9a\u7fa9\u3057\u305f\u30e2\u30c7\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c7\u30fc\u30bf\u306e\u78ba\u8a8d\u306b\u306f Realm \u304c\u958b\u767a\u3057\u3066\u3044\u308b Realm Studio \u3092\u4f7f\u3044\u307e\u3059\u3002\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306f<a href=\"https:\/\/studio-releases.realm.io\/\" data-type=\"URL\" data-id=\"https:\/\/studio-releases.realm.io\/\">\u3053\u3061\u3089<\/a>\u304b\u3089\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u3057\u3066\u3001\u30a2\u30d7\u30ea\u3067\u958b\u767a\u3057\u3066 Realm \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30a2\u30d7\u30ea\u5358\u4f53\u3067\u4f7f\u7528\u3059\u308b\u306a\u3089 <code>try! Realm()<\/code> \u3067\u7c21\u5358\u306b\u4f5c\u308c\u307e\u3059\u304c\u3001\u4eca\u56de\u306f\u8907\u6570\u306e\u30a2\u30d7\u30ea\u3084\u30a6\u30a3\u30b8\u30a7\u30c3\u30c8\u304b\u3089\u5229\u7528\u3059\u308b\u3053\u3068\u3092\u60f3\u5b9a\u3057\u3066 AppGroups \u3067\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"toolbar:1 lang:swift decode:true \" title=\"Swift \u3067 Realm \u3092\u4f7f\u3046\u5834\u5408\" >import Foundation\nimport RealmSwift\n... \u7701\u7565 ...\n\n  private func makeRealm() -&gt; Realm {\n    let baseUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: \"group.com.example\")\n    var config = Realm.Configuration()\n    config.schemaVersion = 1\n    config.fileURL = baseUrl!.appendingPathComponent(\"default.realm\")\n    config.migrationBlock = { migration, old in\n      \/\/ migration\n    }\n    return try! Realm(configuration: config)\n  }\n\n  func outputRealmUrl() {\n    print(\"open -a \\\"MongoDB Realm Studio\\\"\", self.makeRealm().configuration.fileURL?.absoluteString ?? \"\")\n  }\n<\/pre><\/div>\n\n\n\n<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067\u306f <code>outputRealmUrl<\/code>` \u3067\u30b3\u30f3\u30bd\u30fc\u30eb\u306b Realm Studio \u306b\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3057\u3066\u958b\u304f\u305f\u3081\u306e\u30b3\u30de\u30f3\u30c9\u3092\u51fa\u529b\u3057\u3066\u3044\u307e\u3059\u3002\u53e4\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306e Realm Studio \u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u306b\u306f\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3059\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>Opening Realm files of format version 20 is not supported by this version of Realm<\/p><\/blockquote>\n\n\n\n<p><br>\u305d\u306e\u305f\u3081\u3001\u6700\u65b0\u7248\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u53e4\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306f Realm Studio \u306e\u540d\u524d\u304c\u7570\u306a\u308b\u306e\u3067 open \u30b3\u30de\u30f3\u30c9\u306b\u6307\u5b9a\u3059\u308b\u30a2\u30d7\u30ea\u540d\u3082\u5909\u308f\u308a\u307e\u3059\u3002\uff08v10.1.2 \u3067\u306f MongoDB Realm Studio \u3068\u3044\u3046\u30a2\u30d7\u30ea\u540d\uff09<\/p>\n\n\n\n<p>\u51fa\u529b\u4f8b\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>open -a \"MongoDB Realm Studio\" file:\/\/\/Users\/xxxx\/Library\/Developer\/CoreSimulator\/Devices\/XXXXXXXX-4B23-4C2A-AD1D-7B81A59A2FFC\/data\/Containers\/Shared\/AppGroup\/XXXXXXXX-A3C7-4F7D-9FFF-E7AA93F77F62\/default.realm<\/code><\/pre>\n\n\n\n<p><br>\u6700\u521d\u306f\u30d1\u30b9\u3060\u3051\u51fa\u529b\u3057\u3066\u3044\u305f\u306e\u3060\u3051\u3069\u3001\u30a2\u30d7\u30ea\u3092\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u6700\u521d\u304b\u3089\u30c7\u30d0\u30c3\u30b0\u3092\u59cb\u3081\u308b\u3068\u6bce\u56de\u30d5\u30a1\u30a4\u30eb\u3092\u63a2\u3057\u3066\u958b\u304d\u76f4\u3055\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u304f\u3066\u4e0d\u4fbf\u3060\u3063\u305f\u306e\u3067\u76f4\u63a5\u958b\u3051\u308b\u3088\u3046\u306b\u3057\u305f\u3089\u4fbf\u5229\u3060\u3063\u305f\u3088\u3068\u3044\u3046\u304a\u8a71\u3067\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>iOS \u3067\u624b\u8efd\u306b\u30c7\u30fc\u30bf\u3092\u6c38\u7d9a\u5316\u3059\u308b\u5834\u5408 UserDefaults \u304c\u4e00\u822c\u7684\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u306a\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u5fc5\u9808\u3068\u306a\u308a\u307e\u3059\u3002 \u305d\u306e\u5834\u5408\u3001iOS \u304c\u5099\u3048\u3066\u3044\u308b CoreData \u304c\u59cb\u3081\u308b\u5206\u306b\u306f\u624b\u8efd\u3067&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[12],"tags":[14,13],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":266,"url":"https:\/\/tech.for-easy-learning.com\/?p=266","url_meta":{"origin":264,"position":0},"title":"\u3010iOS\/Swift\u3011IGListKit \u30b5\u30f3\u30d7\u30eb\u306e GridSectionController \u3092\u4e00\u822c\u5316\u3059\u308b","date":"2021\u5e745\u67083\u65e5","format":false,"excerpt":"Instagram \u306e iOS \u30c1\u30fc\u30e0\u304c\u958b\u767a\u3057\u3066\u3044\u308b CollectionView \u3092\u4fbf\u5229\u306b\u6271\u3046\u305f\u3081\u2026","rel":"","context":"Swift","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8,"url":"https:\/\/tech.for-easy-learning.com\/?p=8","url_meta":{"origin":264,"position":1},"title":"\u3010WordPress\u3011mac \u306e\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u306b WordPress \u3092\u69cb\u7bc9\u3059\u308b","date":"2021\u5e744\u670827\u65e5","format":false,"excerpt":"WordPress \u3067\u30b5\u30a4\u30c8\u69cb\u7bc9\u3092\u9032\u3081\u308b\u5834\u5408\u3001\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u3092\u5951\u7d04\u3059\u308b\u3053\u3068\u304b\u3089\u59cb\u3081\u306a\u3051\u308c\u3070\u3044\u3051\u306a\u3044\u2026","rel":"","context":"Web\u5168\u822c","img":{"alt_text":"","src":"https:\/\/i1.wp.com\/tech.for-easy-learning.com\/wp-content\/uploads\/2021\/04\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2021-04-27-9.14.10.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":10,"url":"https:\/\/tech.for-easy-learning.com\/?p=10","url_meta":{"origin":264,"position":2},"title":"\u3010WordPress\u3011\u30c7\u30fc\u30bf\u3092\u79fb\u884c\u3059\u308b","date":"2021\u5e744\u670827\u65e5","format":false,"excerpt":"\u4fd7\u306b\u3044\u3046 WordPress \u306e\u304a\u5f15\u3063\u8d8a\u3057\u3067\u3059\u3002\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u3092\u4e57\u308a\u63db\u3048\u305f\u308a\u3001\u524d\u56de\u306e\u8a18\u4e8b\uff08\u3010Wor\u2026","rel":"","context":"WordPress","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6,"url":"https:\/\/tech.for-easy-learning.com\/?p=6","url_meta":{"origin":264,"position":3},"title":"\u3010WordPress\u3011\u6295\u7a3f\u8005\u3084\u30b3\u30e1\u30f3\u30c8\u3092\u975e\u8868\u793a\u306b\u3059\u308b","date":"2021\u5e744\u670827\u65e5","format":false,"excerpt":"WordPress \u306e\u30c6\u30fc\u30de\u306b\u3088\u3063\u3066\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u975e\u8868\u793a\u3092\u9078\u629e\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u975e\u8868\u793a\u306b\u3067\u304d\u306a\u3044\u30c6\u30fc\u30de\u2026","rel":"","context":"WordPress","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tech.for-easy-learning.com\/wp-content\/uploads\/2021\/04\/\u00e3\u0082\u00b9\u00e3\u0082\u00af\u00e3\u0083\u00aa\u00e3\u0083\u00bc\u00e3\u0083\u00b3\u00e3\u0082\u00b7\u00e3\u0083\u00a7\u00e3\u0083\u0083\u00e3\u0083\u0088-2021-04-27-23.09.43.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":12,"url":"https:\/\/tech.for-easy-learning.com\/?p=12","url_meta":{"origin":264,"position":4},"title":"\u3010WordPress\u30111\u3064\u306e MySQL \u3067\u8907\u6570\u306e WordPress \u3092\u69cb\u7bc9\u3059\u308b","date":"2021\u5e744\u670827\u65e5","format":false,"excerpt":"\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u306e\u30d7\u30e9\u30f3\u306b\u3088\u3063\u3066\u306f MySQL \u304c1\u3064\u3057\u304b\u4f7f\u7528\u3067\u304d\u306a\u3044\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u3046\u3057\u305f\u5834\u5408\u3001\u2026","rel":"","context":"WordPress","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4,"url":"https:\/\/tech.for-easy-learning.com\/?p=4","url_meta":{"origin":264,"position":5},"title":"\u3010Web\u3011Basic\u8a8d\u8a3c\u306e\u8a2d\u5b9a","date":"2021\u5e744\u670826\u65e5","format":false,"excerpt":"Web\u30b5\u30a4\u30c8\u306b\u516c\u958b\u3057\u3066\u3044\u308b\u3051\u3069\u4e0d\u7279\u5b9a\u591a\u6570\u306b\u898b\u3089\u308c\u3066\u306f\u56f0\u308b\u3082\u306e\u3063\u3066\u3042\u308a\u307e\u3059\u3088\u306d\u3002\u305d\u3046\u3044\u3063\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u2026","rel":"","context":"Web\u5168\u822c","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=\/wp\/v2\/posts\/264"}],"collection":[{"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264"}],"version-history":[{"count":1,"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions"}],"predecessor-version":[{"id":265,"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions\/265"}],"wp:attachment":[{"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.for-easy-learning.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}