Live data from Hacker News

Flappy Bird in Swift

github.com

81–90 of 126 posts

Re: Flappy Bird in Swift

#82
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.

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.

Re: Flappy Bird in Swift

#83
post #48

Swift looks fine, the only thing I don't like its that is for Apple only products... that kinda defeats the purpose of having a programming language.

Good luck compiling Objective-C on Windows :)

Here you go: http://www.gnustep.org/experience/Windows.html

Re: Flappy Bird in Swift

#84
post #38
post #5

I got mixed feelings about the language at first sight. I guess my mammalian brain recognizes languages based on the particular combination of the following naming decisions. * func, function, fun, defun fu, funct * CamelCase vs snake_case * whitespace, semicolon or comma usage * var, int/integer/uint64/Integer/ * choice of (), {}, [] or better (){a[]} * import/include/require, class/class, override, self vs this, ne…

> PS: next time you design a new language just make a random unique combination of the above. That's my impression whenever I see a new programming language too. Why would someone switch to your language if the syntax is just the same boring old syntax they've been using in another language?

Why would someone switch language if the familiar concepts have been given different names for no good reason?

Use different syntax and naming for the things that are genuinely different about your language.

Re: Flappy Bird in Swift

#85

Swift looks fine, the only thing I don't like its that is for Apple only products... that kinda defeats the purpose of having a programming language.

> Swift looks fine, the only thing I don't like its that is for Apple only products... that kinda defeats the purpose of having a programming language. Tell that to Microsoft ;)

Apple is the new Microsoft.

Re: Flappy Bird in Swift

#86

Earlier quoted context omitted.

That's my problem. I can't even find the entry point for this application. Looking at AppDelegate.swift I see an unused var (window) and that's it.

@UIApplicationMain is the key there, from what I can see. An Objective C iOS app typically includes a main.m entry point which calls UIApplicationMain and passes the AppDelegate. This seems to have been removed in favour of what Swift is calling a "declaration attribute", which presumably does the same thing. In this sense, the code is even less clear than the Objective C implementation.

They removed the need for main by making global scope the entry point.

Re: Flappy Bird in Swift

#88

Swift looks fine, the only thing I don't like its that is for Apple only products... that kinda defeats the purpose of having a programming language.

There are many programming languages that in practice tend to be locked to one platform or another. C# isn't only on Windows and Objective-C isn't only on iOS, but very few people learn either of those languages with the expectation of "write once, run anywhere." (I've found that generally people who use C# on other platforms do so because they already know C# and don't want to learn something else.)

On principle I'd like to see Apple put Swift under a free software license of some kind and ideally make a cross-platform reference implementation, but realistically, even if they do that it's unlikely to ever get wide use anywhere but Apple products.

Re: Flappy Bird in Swift

#89

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 think just the fact that you were able to build a game with just 4 hours of learning a new language speaks volumes about Swift's barrier to entry. Well done!

I think it speaks more to the author's prowess, not to the fantastic magic powers of Apple's latest walled garden.

Re: Flappy Bird in Swift

#90
post #77

Earlier quoted context omitted.

I get where you're coming from - but in my experience, the barrier is totally psychological. Objective C isn't that unusual a language - the syntax is a bit foreign, but nothing that takes more than a couple of days to wrap your head around. You'll spend far more time getting to grips with Cocoa/Cocoa Touch.

the barrier is totally psychological Of course it is. It's certainly not a physical barrier. But psychological or not, other languages don't have a similar barrier.

> other languages don't have a similar barrier

Lisps have the RPN psychological barrier. Python has the significant whitespace psychological barrier. etc. Any language can present someone with some psychological barrier.

I think the OP's strongest point was, Objective-C the language is pretty trivial to learn quickly (after all, it's just C with message passing). You'll spend far longer trying to learn the Cocoa APIs than you will spend learning Objective-C-the-language.

For instance, I decided to try to learn swift and SpriteKit at the same time. I spent far longer looking up methods on SKSpriteNode than I did looking up language constructs. (i.e. I assumed "let" was the same as in ES6 and couldn't figure out why the compiler was mad.)

Post reply on HN