8 ms·
It's again the same boilerplate-code to create something simple as a tableview. I don't understand why they had to 'invent' a new programming language for that.
by meoz 12y ago
It's again the same boilerplate-code to create something simple as a tableview. I don't understand why they had to 'invent' a new programming language for that.
- jameskilton 12y agoThat's not why they built Swift. Objective-C is a difficult language to work with and has decades of cruft. Swift is a start-over, but with Objective-C interop so you still have full access to the full existing APIs for OSX and iOS. Thus, the same boiler plate.
- matwood 12y agoThe 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 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 https://itun.es/us/jEUH0.l
- BugBrother 12y ago>>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.
- martingordon 12y agoIs 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.)
- fit2rule 12y ago>>Swift is a start-over For me, Lua+LuaJIT+C/C++ as a cross-platform solution to everything is a start-over, and it gives me all kinds of things I don't get from Swift, one of them is the ability to make decisions for myself about how the basic structures of the application are going to be managed and under what conditions, either in the VM as needed or out of it, and with whatever current frameworks you want to interface with (e.g. everything). Plus, LuaJIT for the win. Plus put it, simply everywhere. (On:iOS,Linux,OSX,Win,Web,&etc.) Swift is interesting, but I will not again be swayed to the darkside of using platform-provider-provided-platforms to achieve platform nirvana, for that harness contains nails upon which to be pinned. Planks can be assembled of many kinds, but mine is shiny enough without another dastardly developer-mindset-grab by a very, very serious cult. (<<--MacbookPro'er)
- joeblau 12y agoI think the problem is with the boilerplate of objective-c. I tried to make something last night and I'll be honest, I felt like I was in Go or Scala (functional) more than I was in a C-ish style language. I'm not gonna lie, I was looking at some of the docs with a "WTF" look, but I'm a big proponent of functional programming. In the few instances that I've used it, my code has been very concise, but not always easily readable.
- rubiquity 12y agoWhat features of Swift do you find functional? What kind of functional features are you using? I'm asking out of genuine curiosity, not to put you on the spot. Thanks!
- bitpew 12y agoNot to speak for the OP, but two features bear resemblance to functional programming languages: 1) Function Types ( = higher order functions) This allows functions to be passed around as function parameters or return values. 2) Immutable variables via let let a = 1 // a is always bound to the constant 1 a = 2 // error
- emsy 12y agoI couldn't find any built in list/map/set comprehension. Did they leave it out or did I just miss it?
- deleted 12y ago[deleted]
- ktran03 12y ago“The value of a constant doesn’t need to be known at compile time, but you must assign it a value exactly once.” Excerpt From: Inc, Apple. “The Swift Programming Language.” Apple Inc. Check out this book on the iBooks Store: https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewBook?id=881256329 https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewBook?...
- chrisdevereux 12y agoYou are free to use one of the many tableview helper libraries if you aren't happy with the tradeoff between flexibility and convenience that the built-in API makes. You could argue that the frameworks should ship with such a wrapper, but I'd personally rather that they spent their time making difficult things easier than making easy things easier.
- zura 12y agoAgree. While Obj-C is one of the ugliest language, the main problem was/is API/SDK.
- orkoden 12y agoWat? Cocoa is pretty great.