Hacker News new | ask | show | jobs
Swift is coming to PaintCode (paintcodeapp.com)
48 points by melancton 4402 days ago
5 comments

Considering that Apple basically requires an xcode/objc project to deploy iOS apps, I believe Swift will become a popular cross-compiler target especially for GC'd languages. I wouldn't be surprised to hear similar news from RoboVM, MonoTouch, RubyMotion, etc in the coming months.
Why bother? They already produce machine code.
Hm, PaintCode is nice, but I think I'd prefer a library that would let me import SVG files.
Furthermore, Apple did bring up a slide during the Platform State of the Uniform (slide 56 in the PDF) saying source compatibility wouldn't be guaranteed (but that converters would be provided) because the language will evolve. I can't imagine that they'll introduce dramatic changes that will break code generated by PaintCode, but it would be a pain if you have to completely regenerate your all rendering code with each update to Xcode/Swift.
I haven't listened to that presentation or read the PDF, but from what I read about it I would bet that 'evolve' refers more to the time until the official release than to the time after that. Of course the language will evolve, but it will be slower and shouldn't do so in incompatible ways.

Until official release, though, Apple may make huge breaking changes (change keywords, tweak the grammar, maybe drop a feature or two. For example, do we really need trap on overflow for integers in what, in the end, is a compiled language?)

I wonder if the generated code will be visualized when using Playgrounds. Anyone know? I haven't tried rendering code yet in Playgrounds.

I emailed Paintcode asking this same question. Will post if I get a response.

The Platforms State of the Union at WWDC did bezier path drawing, so I'd say yes.
So, how on earth did they get this out that quickly?
The code generator for PaintCode is probably fairly small -- all the complexity of the app is in the beautiful UI.

The graphics code they generate is mostly just using these CGContext APIs: https://developer.apple.com/library/ios/documentation/Graphi...

Mapping to the Swift counterparts should be straightforward.

Let's say that this thing in their pocket was indeed them being happy to see an Objective-C replacement.

On a more serious note, Apple has a practice of cooperating with a small selection of developers (who sign a bunch of scary NDA's) when testing new technologies.

It's certainly the case that some folks get early access, I don't really think that was necessary to make this happen so quickly. I'm not saying they didn't have early access, just that they...

1) already had a code generator for Objective-C

2) already had infrastructure for alternate code generators (they also support C#)

3) Swift and Objective-C share the same libraries and have similar semantics where it counts

4) Writing code generators isn't really all that difficult

It's perfectly believable that they banged out enough of a first-cut at this to make an announcement within a day or two of the Swift release.

Of course.

You know Swift is just so natural to both Objective-C, Java, Scala, C# etc. devs already, and so much simpler than Objective-C, I have the feeling we'll see the fastest adoption of a brand new language in the history of computing here.

Is there any info on whether Swift can be used on Linux / be embedded?
At present the only known implementation is paired with Xcode 6 and runs on OS X only. We'll have to see if Apple open sources their front end implementation (that runs atop LLVM). If they do then it'd probably be reasonably straightforward to retarget it for other operating systems where LLVM is supported, if there's a run time to pair it with (like GnuStep).
Looks like Swift will be open source from a few tweets. I imagined as much with Apple's work on LLVM. Though the big issue is like Objective-C, it's near worthless without Cocoa and all the stuff Apple keeps closed.

https://twitter.com/mxweas/status/474581160454942721