Live data from Hacker News

Flappy Bird in Swift

github.com

101–110 of 126 posts

Re: Flappy Bird in Swift

#101
post #49
post #43

Earlier quoted context omitted.

I find obj-c super readable, other people don't? I mean, take two hours to get used to the bracket syntax for message sending and it's super readable although a bit verbose?

Same here. All you have to do is get over named parameters, square bracket message passing, and overall verbosity, and you know enough to read/understand Objective-C code. If you can get past those three differences, Objective-C is remarkably similar to Java and other OOP languages. Personally, I love the verbosity. The code pretty much just explains itself. Swift is a welcomed change though. I'm very optimistic and…

Please take this in good humour but I couldn't resist:

> All you have to do is get over named parameters, square bracket message passing, and overall verbosity

Translation: "All you have to do is get over it's poor readability and it's quite readable!"

> Objective-C is remarkably similar to Java and other OOP languages.

Translation: "Objective-C is as readable as several other unreadable languages".

;-)

Readability isn't about familiarity as much as it's about clarity and a lack of boilerplate. Verbosity is in most cases the antithesis if readability. I think there can be exceptions (maybe some verbose DSLs that manage to map cleanly from your brain to the code on the page) but if the verbosity comes from boilerplate or visual clutter then verbosity is a strong point against.

Re: Flappy Bird in Swift

#102

Earlier quoted context omitted.

Yes, you still need a Mac to develop for iOS. Come to the dark side! :)

Android developer here with a Macbook Pro. I'm honestly thinking about taking the leap and getting an iPhone, depending on how the 6 looks like. But Swift enticed me very much.

You won't regret it

Re: Flappy Bird in Swift

#103
post #87

Flappy Bird in Racket | https://github.com/soegaard/flappy-bird

Man, apparently dr racket format looks like a hot mess.

A normal Racket file is a straight forward text file.

In Flappy Bird I used inline images, as in (define bird ) This makes it simple to distribute the source and images as a single file, but unfortunately the resulting file is not pretty.

In short: to see the source open it in DrRacket.

Re: Flappy Bird in Swift

#104
post #55

Always had a problem with Objective C, could never read it (Android Dev) but this right here is pretty impressive. I like the mixture of language features. But my only question, are you still locked to using an mac to develop for iOS. I guess since the language is closed source it depends on some osx libs at compile time.

What is so hard about reading Objective-C? I've seen this as a very common thread with people celebrating the arrival of Swift.

I'm not trying to be flippant and I understand that the named parameter format may throw some people for a loop, but I'm curious why it appears to be such a limiting factor in trying Objective-C.

Re: Flappy Bird in Swift

#105

Author here - I didn't expect to see this here this morning. I'd intended to write a longer post :) In any case, here's a few things I learned about swift yesterday building this. Please note that I have about 4 hours swift experience, so feel free to correct anything I say that's wrong. 1. To make properties on a class you simply declare the variable on the class e.g.: class GameScene: SKScene { var bird = SKSpriteN…

I don't have XCode to try it out, but according to the book, you can replace var spawn = SKAction.runBlock({() in self.spawnPipes()}) with var spawn = SKAction.runBlock({self.spawnPipes()}) or even var spawn = SKAction.runBlock() {self.spawnPipes()} or var spawn = SKAction.runBlock {self.spawnPipes()} EDIT: formatting for code

What about this?

  var spawn = SKAction.runBlock self.spawnPipes

Re: Flappy Bird in Swift

#108

Earlier quoted context omitted.

I don't have XCode to try it out, but according to the book, you can replace var spawn = SKAction.runBlock({() in self.spawnPipes()}) with var spawn = SKAction.runBlock({self.spawnPipes()}) or even var spawn = SKAction.runBlock() {self.spawnPipes()} or var spawn = SKAction.runBlock {self.spawnPipes()} EDIT: formatting for code

What about this? var spawn = SKAction.runBlock self.spawnPipes

Heh. Reminds me of when I correct people for

  if var == true {...}
or (and I have actually seen this)

  if ( == true) {
      return true;
  } else {
      return false;
  }
I sometimes think that simply giving those 5 lines to a person and observing if they make a face like you've handed them a bucket full of day-old fish is a better test for programming aptitude than anything.

Re: Flappy Bird in Swift

#109
post #108

Earlier quoted context omitted.

What about this? var spawn = SKAction.runBlock self.spawnPipes

Heh. Reminds me of when I correct people for if var == true {...} or (and I have actually seen this) if ( == true) { return true; } else { return false; } I sometimes think that simply giving those 5 lines to a person and observing if they make a face like you've handed them a bucket full of day-old fish is a better test for programming aptitude than anything.

I'd argue the second is clearer in many cases. Readability trumps conciseness any day.

Re: Flappy Bird in Swift

#110

Earlier quoted context omitted.

I don't have XCode to try it out, but according to the book, you can replace var spawn = SKAction.runBlock({() in self.spawnPipes()}) with var spawn = SKAction.runBlock({self.spawnPipes()}) or even var spawn = SKAction.runBlock() {self.spawnPipes()} or var spawn = SKAction.runBlock {self.spawnPipes()} EDIT: formatting for code

What about this? var spawn = SKAction.runBlock self.spawnPipes

Are you sure this should work? I checked the grammar once more and it seems that closure-expression should always be enclosed in { ... }
Post reply on HN