-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from MercuryTechnologies/kb/swift-inits
Generate public initializers for Swift
- Loading branch information
Showing
24 changed files
with
132 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
data class Data( | ||
val field0: Int, | ||
// Deprecated since build 500 | ||
// val field1: Int? = null, | ||
// Deprecated since build 500 | ||
// val field1: Int? = null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
public struct Newtype { | ||
public var newtypeField: Enum | ||
|
||
public init(newtypeField: Enum) { | ||
self.newtypeField = newtypeField | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
public struct Data: CaseIterable, Hashable, Codable { | ||
public var field0: Int | ||
public var field1: Int? | ||
|
||
public init(field0: Int, field1: Int? = nil) { | ||
self.field0 = field0 | ||
self.field1 = field1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
public struct Newtype { | ||
public var newtypeField: String | ||
|
||
public init(newtypeField: String) { | ||
self.newtypeField = newtypeField | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
public struct Newtype { | ||
public var newtypeField: Result<Int, String> | ||
|
||
public init(newtypeField: Result<Int, String>) { | ||
self.newtypeField = newtypeField | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
public struct Data { | ||
public var field0: Int | ||
public var field1: Int? | ||
|
||
public init(field0: Int, field1: Int? = nil) { | ||
self.field0 = field0 | ||
self.field1 = field1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
public struct Tree<A: Hashable & Codable>: Hashable, Codable { | ||
public var rootLabel: A | ||
public var subForest: [Tree<A>] | ||
|
||
public init(rootLabel: A, subForest: [Tree<A>]) { | ||
self.rootLabel = rootLabel | ||
self.subForest = subForest | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
public struct Data<A: Hashable & Codable, B: Hashable & Codable>: CaseIterable, Hashable, Codable { | ||
public var field0: A | ||
public var field1: B | ||
|
||
public init(field0: A, field1: B) { | ||
self.field0 = field0 | ||
self.field1 = field1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
.golden/swiftRecord0SumOfProductWithTaggedFlatObjectStyleSpec/golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
public struct Record0: Codable { | ||
public var record0Field0: Int | ||
public var record0Field1: Int | ||
|
||
public init(record0Field0: Int, record0Field1: Int) { | ||
self.record0Field0 = record0Field0 | ||
self.record0Field1 = record0Field1 | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
.golden/swiftRecord0SumOfProductWithTaggedObjectStyleSpec/golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
public struct Record0: Codable { | ||
public var record0Field0: Int | ||
public var record0Field1: Int | ||
|
||
public init(record0Field0: Int, record0Field1: Int) { | ||
self.record0Field0 = record0Field0 | ||
self.record0Field1 = record0Field1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
.golden/swiftRecord1SumOfProductWithTaggedFlatObjectStyleSpec/golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
public struct Record1: Codable { | ||
public var record1Field0: Int | ||
public var record1Field1: Int | ||
|
||
public init(record1Field0: Int, record1Field1: Int) { | ||
self.record1Field0 = record1Field0 | ||
self.record1Field1 = record1Field1 | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
.golden/swiftRecord1SumOfProductWithTaggedObjectStyleSpec/golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
public struct Record1: Codable { | ||
public var record1Field0: Int | ||
public var record1Field1: Int | ||
|
||
public init(record1Field0: Int, record1Field1: Int) { | ||
self.record1Field0 = record1Field0 | ||
self.record1Field1 = record1Field1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
public struct RecordA { | ||
public var fieldA: String | ||
|
||
public init(fieldA: String) { | ||
self.fieldA = fieldA | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
public struct RecordB { | ||
public var c: String | ||
|
||
public init(c: String) { | ||
self.c = c | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
public struct Data<A: Hashable & Codable>: CaseIterable, Hashable, Codable { | ||
public var field0: A | ||
|
||
public init(field0: A) { | ||
self.field0 = field0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters