Implemented the "init(session: )" initialiser for the ServiceConfiguration+Inits extension in the iTunes library.

This commit is contained in:
Javier Cicchelli 2024-03-17 16:44:32 +01:00
parent ab81347b22
commit 54a546594d
3 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,22 @@
//
// JSONDecoder+Constants.swift
// ReviewsiTunesKit
//
// Created by Javier Cicchelli on 17/03/2024.
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
//
import Foundation
extension JSONDecoder {
// MARK: Constants
static let `default` = {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .iso8601
return decoder
}()
}

View File

@ -0,0 +1,23 @@
//
// ServiceConfiguration+Inits.swift
// ReviewsiTunesKit
//
// Created by Javier Cicchelli on 17/03/2024.
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
//
import Foundation
import ReviewsFeedKit
extension ServiceConfiguration {
// MARK: Initialisers
init(session: URLSessionConfiguration = .ephemeral) {
self.init(
host: .iTunes,
session: session,
decoder: .default
)
}
}

View File

@ -0,0 +1,17 @@
//
// URL+Constants.swift
// ReviewsiTunesKit
//
// Created by Javier Cicchelli on 17/03/2024.
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
//
import Foundation
import ReviewsFoundationKit
extension URL {
// MARK: Constants
static let iTunes: URL = .init(string: "https://itunes.apple.com") ?? .bitBucket
}