Skip to content

Commit af8dc02

Browse files
author
yzhou
committed
add supports for customizable imports from plugins
1 parent 3448aec commit af8dc02

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

Sources/ImmutableSwift/generating/plugins/ISCodable.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ class ISCodable: ImmutableSwiftGeneratorPlugin {
55
return false
66
}
77

8+
func imports() -> [String] {
9+
return ["Foundation"]
10+
}
11+
812
func superClasses() -> [String] {
913
return ["Codable"]
1014
}

Sources/ImmutableSwift/generating/plugins/ISCoding.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ class ISCoding: ImmutableSwiftGeneratorPlugin {
3838
return true
3939
}
4040

41+
func imports() -> [String] {
42+
return ["Foundation"]
43+
}
44+
4145
func superClasses() -> [String] {
4246
return ["NSObject", "NSCoding"]
4347
}

Sources/ImmutableSwift/generating/plugins/ISCopying.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ class ISCopying: ImmutableSwiftGeneratorPlugin {
55
return true
66
}
77

8+
func imports() -> [String] {
9+
return ["Foundation"]
10+
}
11+
812
func superClasses() -> [String] {
913
return ["NSCopying"]
1014
}

Sources/ImmutableSwift/generating/plugins/ISHashable.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ class ISHashable: ImmutableSwiftGeneratorPlugin {
55
return false
66
}
77

8+
func imports() -> [String] {
9+
return ["Foundation"]
10+
}
11+
812
func superClasses() -> [String] {
913
return ["Hashable"]
1014
}

Sources/ImmutableSwift/generating/plugins/PluginUtils.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
protocol ImmutableSwiftGeneratorPlugin {
22
static var Name: String { get }
33
func shouldUseClass() -> Bool
4+
func imports() -> [String]
45
func superClasses() -> [String]
56
func postVariableDefinition(_ datamodel: DataModel) -> String
67
func postConstructor(_ datamodel: DataModel) -> String

0 commit comments

Comments
 (0)