Files
purchases-ios/Sources/LocalReceiptParsing/Helpers/FileReader.swift
T

31 lines
719 B
Swift
Raw Normal View History

//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// FileReader.swift
//
// Created by Nacho Soto on 1/10/23.
import Foundation
/// A type that can read data from disk
/// Useful for mocking.
protocol FileReader {
func contents(of url: URL) throws -> Data
}
/// Default implementation of `FileReader` that simply uses `Data`'s implementation.
final class DefaultFileReader: FileReader {
func contents(of url: URL) throws -> Data {
return try Data(contentsOf: url)
}
}