ResultBuilder - buildExpression

Updated
Mar 15, 2021 6:30 PM
Created
Mar 15, 2021 6:29 PM
Tags
Swift
Keywords

struct Condition {
  
  static func factory() -> Self {
    .init()
  }
}

@resultBuilder
enum Mybuilder<Root> {
  
  static func buildBlock(_ components: Condition...) -> Condition {
    fatalError()
  }
  
  static func buildExpression(_ component: Condition) -> Condition {
    component
  }
    
  static func buildExpression<U>(_ expression: KeyPath<Root, U>) -> Condition {
    fatalError()
  }
}

func run(@Mybuilder<String> _ build: () -> Condition) {
  
}

run {
  .factory();
  .factory();
  \.count;
  \.endIndex;
}