mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
31 lines
719 B
Swift
31 lines
719 B
Swift
//
|
|||
|
|
// 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)
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|