[swift-evolution] Binding generic types using a metatype parameter

Joanna Carter joanna at carterconsulting.org.uk
Wed Mar 23 12:13:40 CDT 2016


I'm not sure if this is an appropriate conversation to bring this up on but, here goes.

I have a need, for serialisation and various other uses, to be able to create an instance of a generic type, with the parameter type(s) stored in (a) var(s) of Any.Type.

Typically, the origin of the metatype is something like a Mirror's subjectType property.

Some of the proposals for Swift 3 seem to touch on similar needs but I was not sure whether to pollute those discussions or not


Background…

I am an experienced frameworks developer, with over 20 years experience in the field but much of the first half of that was in C#, where such things are handled very well by the reflection provided in .NET.

I now also have 10 years Objective-C experience and started playing with Swift from the get-go but am finding the limitations of Swift's reflection to be very frustrating, especially for such a common use case as serialisation.

Joanna

--
Joanna Carter
Carter Consulting



More information about the swift-evolution mailing list