Say, if I have a generic Swift class Foo, is there a way to have it generate different code depending on whether T is a struct or a class? I.e. add an & for a mutator call or an inout to a parameter?

Follow

@uliwitness you can constrain a generic by using ‘where T: AnyObject’ but there is no negations to constrain where not something

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!