Swift Generics Evolution – Don’t Panic

Swift Generics Evolution – Don’t Panic

It discussed a lot of possible changes to the way that generics work in the Swift language, and kicked off the process with a link to SE-244, a proposal to introduce some features around function return values. For example, we might have a helper inside a Canvas object that draws a single Shape at a point:

We might have another helper that adds a new Shape of some type to our Canvas, returning the new instance:

This is probably familiar ground to Swift developers who have used generics even a little bit. Where right now, the caller binds generic types as it calls a function, the proposal would have the function itself bind the return types and pass concrete values back out.

Source: www.timekl.com