> Le 19 nov. 2016 à 15:58, Alan Cabrera via swift-evolution > <[email protected]> a écrit : > > I’m not sure if this was proposed or not; or even if this is a Swift-ly way > of doing things. It would be pretty handy to be able to declare init() > functions in my module to register handlers. It’s a common pattern in > enterprise software. > > Currently, I have to generate a lot of boilerplate code to emulate the > behavior. I think it would be cleaner to have these global init() functions. >
I’d rather like a swift attribute equivalent to : __attribute__((constructor)) It will not force me to call my initializer init, and moreover it will let me declare multiple functions so I would be able to register multiples handlers from a single module without having to group all the register call into a single init() function.
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
