api-generator-templates/Swift/ApiDateFormattingService.sw...

36 lines
805 B
Twig

{%- import 'macroses/common.utils.twig' as utils -%}
{%- set hasDateFormats = dateFormats is not empty -%}
{%- if hasDateFormats %}
import LeadKit
import SwiftDate
public enum ApiDateFormat: String, DateFormat {
{% for format in dateFormats -%}
case {{ format.name }} = "{{ format.format }}"
{% endfor %}
public var dateToStringFormat: DateToStringStyles {
return .custom(rawValue)
}
public var stringToDateFormat: StringToDateStyles {
return .custom(rawValue)
}
}
public final class ApiDateFormattingService: DateFormattingService, Singleton {
public typealias DateFormatType = ApiDateFormat
public static let shared = ApiDateFormattingService()
public var currentRegion: Region = .local
private init() {}
}
{{ "\n" }}
{%- endif -%}