On 8 November 2017 at 10:54, Benjamin G <benjamin.garrig...@gmail.com> wrote:
> All your use cases make perfect sense, however i see one potential issue > with this "pattern" : > > I've seen a LOT of iOS developers (some juniors, some not) ending up with > monstruous UIViewControllers, and it has happened almost since the very > beginning of iOS development. Because of their lack of understanding of the > MVC pattern, they completely under estimate either the model or the view > layer and put too many things in their VC. > > Now this pattern would give them the illusion that they're working in a > sane architecture and that they've decomposed the problem correctly, but in > fact were not. The fact that extension wouldn't let you add variable makes > it harder to conceal the problem, but with "continuations" i can see no > limit. > > What do you think ? > > good tools won't fix bad developers (c) you know that you can already sort of "store variables" in extensions, right? obj-c associated object is one way (1). and if we are talking about the use case of extending "your own types only" -- i am -- your own classes are under your full control, so nobody stops you from having, say, an "extensionVars" dictionary in your root class(es) and a handy set of generic api's to get/set those in a convenient manner without too much effort (2). is it ideal? no. performance suffers. usability suffers. non trivial to have weak/unowned variables with (2). not a "first class citizen" solution. the sheer number of hits of "how to i store variables in extensions in swift" (more than a million now) hints you that the language can step in to help, at least in the critical use case of "own types". Mike
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution