質問編集履歴
1
基礎を見直すと解決できます。
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,87 +11,3 @@
|
|
11
11
|
Realmでは可能でしょうか?
|
12
12
|
|
13
13
|
どなたかRealmに詳しい方、助言を頂けたら幸いです。
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
```ここに言語を入力
|
18
|
-
|
19
|
-
class User: Object {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@objc dynamic var id: Int = 0
|
24
|
-
|
25
|
-
@objc dynamic var fullname: String = ""
|
26
|
-
|
27
|
-
@objc dynamic var username: String = ""
|
28
|
-
|
29
|
-
@objc dynamic var profileText: String? = ""
|
30
|
-
|
31
|
-
@objc dynamic var profileImage: Data? = nil
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
var tweets = List<Tweet>()
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
override static func primaryKey() -> String? {
|
40
|
-
|
41
|
-
return "id"
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}
|
48
|
-
|
49
|
-
```
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
```ここに言語を入力
|
54
|
-
|
55
|
-
class Tweet: Object {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
@objc dynamic var tweetId: Int = 0
|
60
|
-
|
61
|
-
@objc dynamic var caption: String = ""
|
62
|
-
|
63
|
-
@objc dynamic var timestamp: Date = Date()
|
64
|
-
|
65
|
-
@objc dynamic var retweetCount: Int = 0
|
66
|
-
|
67
|
-
@objc dynamic var likes: Int = 0
|
68
|
-
|
69
|
-
@objc dynamic var didLike = false
|
70
|
-
|
71
|
-
@objc dynamic var replyingTo: String?
|
72
|
-
|
73
|
-
@objc dynamic var isReply: Bool { return replyingTo != nil }
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
let users = LinkingObjects(fromType: User.self, property: "tweets")
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
var replyTweet = List<ReplyTweet>()
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
override static func primaryKey() -> String? {
|
86
|
-
|
87
|
-
return "tweetId"
|
88
|
-
|
89
|
-
}
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
```
|