3 Commits
0.0.6 ... 0.0.7

Author SHA1 Message Date
Oleksii Dykan
3cae6e90d9 Bump version number 2018-02-20 23:13:02 +01:00
Oleksii Dykan
222b080693 Merge pull request #24 from alickbass/update-encoder
Update Encoder
2018-02-20 23:11:31 +01:00
Oleksii Dykan
5b8627dbbe If the value pushed a container before throwing, pop it back off to restore state 2018-02-20 23:00:29 +01:00
3 changed files with 14 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "CodableFirebase" s.name = "CodableFirebase"
s.version = "0.0.6" s.version = "0.0.7"
s.summary = "Use Codable with Firebase" s.summary = "Use Codable with Firebase"
s.description = "This library helps you use your custom models that conform to Codable protocol with Firebase Realtime Database and Firestore" s.description = "This library helps you use your custom models that conform to Codable protocol with Firebase Realtime Database and Firestore"
s.homepage = "https://github.com/alickbass/CodableFirebase" s.homepage = "https://github.com/alickbass/CodableFirebase"

View File

@@ -393,11 +393,20 @@ extension _FirebaseEncoder {
} }
// The value should request a container from the _FirebaseEncoder. // The value should request a container from the _FirebaseEncoder.
let depth = storage.count let depth = self.storage.count
try value.encode(to: self) do {
try value.encode(to: self)
} catch {
// If the value pushed a container before throwing, pop it back off to restore state.
if self.storage.count > depth {
let _ = self.storage.popContainer()
}
throw error
}
// The top container should be a new container. // The top container should be a new container.
guard storage.count > depth else { guard self.storage.count > depth else {
return nil return nil
} }

View File

@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.0.6</string> <string>0.0.7</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>