Swift - 使用Realm (4) 如何讓你的id 自動增加 (auto increment)
本篇摘要
- Realm implement auto increment
func incrementID() -> Int {
return (database.objects(RealmItem.self).max(ofProperty: "id") as Int? ?? 0) + 1
}
留言
張貼留言