From b567aa20d9d87654fba1cf49984329d3d3fa49b3 Mon Sep 17 00:00:00 2001 From: Artur Mkrtchyan Date: Tue, 14 Apr 2020 23:57:13 +0400 Subject: [PATCH] Minor fix --- Unrealm.podspec | 2 +- Unrealm/Classes/Swift/Unrealm.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Unrealm.podspec b/Unrealm.podspec index e77bd46..b9a7746 100755 --- a/Unrealm.podspec +++ b/Unrealm.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = 'Unrealm' s.swift_version = '5.1' - s.version = '1.2.1' + s.version = '1.2.2' s.summary = 'Unrealm is an extension on RealmCocoa, which enables Swift native types to be saved in Realm.' s.description = <<-DESC Unrealm enables you to easily store Swift native Classes, Structs and Enums into Realm. diff --git a/Unrealm/Classes/Swift/Unrealm.swift b/Unrealm/Classes/Swift/Unrealm.swift index 46b011e..2f19bbc 100644 --- a/Unrealm/Classes/Swift/Unrealm.swift +++ b/Unrealm/Classes/Swift/Unrealm.swift @@ -372,7 +372,7 @@ public extension Object { func toRealmable() -> RealmableBase? { let objTypeString = self.typeString() ?? "" - if let type = objectsAndRealmables.first(where: {objTypeString.contains($0.key)})?.value { + if let type = objectsAndRealmables.filter({objTypeString.contains($0.key)}).map{($0, $1)}.sorted(by: {$0.0 > $1.0}).first?.1 { let convertedObj = self.toRealmable(of: type) return convertedObj as? RealmableBase }