Hacker News new | ask | show | jobs
by matwood 4406 days ago
The thing is, understanding Obj-C was never the hard part. For example, understanding ARC, weak vs. strong (and now unowned [1]), and the various libraries is what took time and experience. Swift doesn't solve that at all and in fact offers its own oddities like the below:

“You indicate type methods for classes by writing the keyword class before the method’s func keyword, and type methods for structures and enumerations by writing the keyword static before the method’s func keyword.”

Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l

I do think the new language is neat and will be fun to work in, but it doesn't solve the parts that tripped up many people when working in Objc.

[1]

    @lazy var asHTML: () -> String = {
        [unowned self] in
        if let text = self.text {
            return "<\(self.name)>\(text)</\(self.name)>"
        } else {
            return "<\(self.name) />"
        }
    }
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l
2 comments

Is there ever a time when you don't want a weak/unowned self in a block? Perhaps this should be made the default in Swift? (I understand that the Blocks spec requires all captured variables to be strong unless otherwise specified.)
>>understanding Obj-C was never the hard part.

It seems important for traction to make the beginning learning curve non-steep. See PHP, Python, etc.