From 75143ccb869894586cf0eeb1a18f25fef951f9a9 Mon Sep 17 00:00:00 2001 From: yzhou <> Date: Sun, 17 Feb 2019 15:20:34 -0800 Subject: [PATCH] add default plugins --- Sources/ImmutableSwift/generating/Generator.swift | 7 ++++++- .../ImmutableSwift/generating/plugins/PluginUtils.swift | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Sources/ImmutableSwift/generating/Generator.swift b/Sources/ImmutableSwift/generating/Generator.swift index 9a10198..bb6b032 100644 --- a/Sources/ImmutableSwift/generating/Generator.swift +++ b/Sources/ImmutableSwift/generating/Generator.swift @@ -1,7 +1,12 @@ class Generator { static func Generate(_ datamodel: DataModel) -> String { var output = "" - let pluginList = datamodel.plugins + let pluginList : PluginList? + if datamodel.plugins != nil{ + pluginList = datamodel.plugins + } else{ + pluginList = PluginList(Plugins.defaultPlugins) + } // optional imports if datamodel.imports != nil { diff --git a/Sources/ImmutableSwift/generating/plugins/PluginUtils.swift b/Sources/ImmutableSwift/generating/plugins/PluginUtils.swift index 0db606e..70b4daa 100644 --- a/Sources/ImmutableSwift/generating/plugins/PluginUtils.swift +++ b/Sources/ImmutableSwift/generating/plugins/PluginUtils.swift @@ -14,4 +14,10 @@ struct Plugins { ISCodable.Name: ISCodable(), ISCopying.Name: ISCopying(), ] -} + + static let defaultPlugins : [String] = [ + ISHashable.Name, + ISCodable.Name, + ISCopying.Name, + ] +} \ No newline at end of file