@brentsimmons Something like this?https://gist.github.com/tjw/4f3ea2be02e5877746aa …
-
-
-
@tjw@brentsimmons Latest Swift has different syntax.https://gist.github.com/tjw/4f3ea2be02e5877746aa …
-
-
-
@brentsimmons the same way as C++, an ugly switch statemetn! Or this: https://gist.github.com/owensd/bfe4ff8e17bbf6db842c …. -
@brentsimmons oh, I updated the gist to show dynamically returning a different type based on a value.
-
-
-
@brentsimmons use a protocol -
@mhp@brentsimmons To be fair, that's the answer for everything in swift lately… :) -
@ccgus@brentsimmons but this time it's the actual answer, not the snarky answer
-
-
@brentsimmons (from $SVNROOT/trunk/Staff/bungi/Radar/Swift/fixed/instantiate-from-class.swift) -
@brentsimmons protocols, protocols, protocols... -
@brentsimmons I did the Completely Insane solution: build script that finds annotated classes and writes the instantiate-from-string func. -
-
@brentsimmons Isn't this inherently unsafe (due to not knowing whether initWithString: is a valid method on whatever class is returned? -
@brentsimmons (And therefore not possible in Swift)
-
-
@brentsimmons protocol, formalize all the things
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Brent Simmons
Tim Wood
Wil Shipley
David Owens II
Brent Royal-Gordon
Mark Pavlidis
Gus Mueller
Nate de Jager
Donald Hays
Scott Berrevoets