Merge pull request #18 from TouchInstinct/fix/singleton

fix singleton and empty date formats
This commit is contained in:
Ivan Smolin 2018-04-02 17:47:30 +03:00 committed by GitHub
commit b366d51ee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -1,10 +1,13 @@
{%- import 'macroses/common.utils.twig' as utils -%}
{%- import 'macroses/class.utils.twig' as classUtils -%}
{%- set hasDateFormats = dateFormats is not empty -%}
{%- if hasDateFormats %}
import LeadKit
import SwiftDate
enum ApiDateFormat: String, LeadKit.DateFormat, Singleton {
enum ApiDateFormat: String, LeadKit.DateFormat {
{% for format in dateFormats -%}
{%- set classType = classUtils.classType(format.type) -%}
@ -16,7 +19,7 @@ enum ApiDateFormat: String, LeadKit.DateFormat, Singleton {
}
final class ApiDateFormattingService: DateFormattingService {
final class ApiDateFormattingService: DateFormattingService, Singleton {
typealias DateFormatType = ApiDateFormat
@ -27,3 +30,4 @@ final class ApiDateFormattingService: DateFormattingService {
private init() {}
}
{%- endif -%}