Swift - Can it make me a programmer?
The Apple Keynote was pretty exciting and I was really surprised at the announcement of the new language Swift. I saw a few tweets about people excited to try Swift out as a way to finally make a breakthrough in learning programming. As someone who has worked his way through a couple of the Big Nerd Ranch books and was currently in the middle of a great video on Lynda.com on Object Oriented Programming , I must admit I was of the same mind. After a bit of poking around on it, it's certainly much simpler than objective-C syntax. However, it is not going to suddenly make me able to code more useful or complex apps. I simply haven't yet got the hang of object oriented concepts. I'm stuck with old Basic procedural thoughts and can't seem to get past the basics on OSX or iOS apps. The playground is fun and I can manipulate strings with the best of them but the whole NSRect vs CGRect and getting the views and layers to update still isn't straight forward for me. I need a helper function to convert a NSBezier path to a CGBezier path...? Still, it's fun and challenging so I'll keep at it.
I did a fair bit of the Stanford CS106A class in ITunes U about a year ago. I don't like the eclipse IDE and prefer the Mac so I was just starting to do the assignments in Objective-C before the Keynote. My thinking was if I can convert this to X-Code and Objective-C, I'll probably understand the concepts better. I was able to get the Pyramid and Target bits sorted from assignment 2 but not without a fair amount of trouble on how to get the view connected to the code. (That and how to get the width of the view in objective-C). NSColor is not at all intuitive but I digress. This week I converted the pyramid assignment to Swift without too much trouble although the color part should be simpler than NSColor.redColor().set(). Color seems like an attribute of my Rectangle and not an object on its own. I'm guessing I didn't do it the easiest way.
I think folks will really enjoy the playground features but I wouldn't say we're going to have a flood of newbies suddenly releasing Apps into the wild!
Part of assignment 2 from Stanford’s CS106A course. Where is the NSCircle class again?
This exercise has you make a pyramid based on some given constants and make it centered on the window and stay centered as the window is resized. There’s a big gap from this to Flappy Birds let alone something as simple as Drag and Drop…Swift will help but it won’t get you all the way there.