Implemented the "encode(to: )" function of the Encodable protocol for the Feed model in the iTunes library.
This commit is contained in:
parent
f6a72e8465
commit
bd72c4fb7c
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import ReviewsFoundationKit
|
||||||
import ReviewsFeedKit
|
import ReviewsFeedKit
|
||||||
|
|
||||||
extension ServiceConfiguration {
|
extension ServiceConfiguration {
|
||||||
|
@ -36,3 +36,16 @@ extension Feed: Decodable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Encodable
|
||||||
|
extension Feed: Encodable {
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
func encode(to encoder: any Encoder) throws {
|
||||||
|
var feed = encoder.container(keyedBy: FeedKeys.self)
|
||||||
|
var feedEntry = feed.nestedContainer(keyedBy: EntryKeys.self, forKey: .feed)
|
||||||
|
|
||||||
|
try feedEntry.encode(entries, forKey: .entry)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user