DataLireCoder swift package

This commit is contained in:
2025-04-27 12:53:43 +03:00
parent 2cca986016
commit 5aec6ea578
60 changed files with 7144 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import Foundation
/// A common interface for formatting and parsing `Date` values.
///
/// The `DateFormatterProtocol` abstracts the interface of date formatters, allowing
/// interchangeable use of `DateFormatter` and `ISO8601DateFormatter` when encoding or decoding
/// date values.
public protocol DateFormatterProtocol {
/// Returns a string representation of the specified date.
///
/// - Parameter date: The `Date` to format.
/// - Returns: A string that represents the formatted date.
func string(from date: Date) -> String
/// Converts the specified string into a `Date` object.
///
/// - Parameter string: The date string to parse.
/// - Returns: A `Date` object if the string could be parsed, or `nil` otherwise.
func date(from string: String) -> Date?
}
extension ISO8601DateFormatter: DateFormatterProtocol {}
extension DateFormatter: DateFormatterProtocol {}