Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UnionType code generator #2

romanroibu opened this issue Jan 8, 2020 · 0 comments

Add UnionType code generator #2

romanroibu opened this issue Jan 8, 2020 · 0 comments


Copy link

@romanroibu romanroibu commented Jan 8, 2020

Add a script that uses SwiftSyntax (or another code generator) to generate protocol conformance for enums with cases that all have only one value, and the types of the values all conform to the same protocols.


protocol Proto1 {
    var foo: Int { get }

protocol Proto2 {
    func bar(_ x: Float) -> String

protocol Proto3 {
    func bar(_ x: Float, _ y: Float) -> String

struct A: Proto1, Proto2 {
    let foo = 123

    func bar(_ x: Float) -> String {
        return "Hello from A: \(x)"
@romanroibu romanroibu self-assigned this Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.