Prototype icon indicating copy to clipboard operation
Prototype copied to clipboard

Add support for generic data types

Open dwb357 opened this issue 1 year ago • 0 comments

Given:

@Prototype(kind: .form)
struct Model<Data> where Data: Numeric {
   var value: Data
}

the generated form should read through the Data generic value to the Numeric type to generate:

   LabeledContent(...) {
      TextField("", $model.value, number formatter)
   }

Note that even this is really only partial support due to the nature of swift macros. Since they are processing text, they only have information available at parsing time, ie., they can't determine the actual type of Data, and still must handle Numeric rather abstractly.

dwb357 avatar Feb 26 '25 17:02 dwb357