top | item 22301652

Swift Playgrounds for macOS

434 points| rock_artist | 6 years ago |apps.apple.com | reply

228 comments

order
[+] jedieaston|6 years ago|reply
Now, Apple, can we please have the opposite? XCode on the iPad (even if some features had to be removed, like VS Code is to VS), with a containerized shell to run code we write in?

Please?

[+] neurobashing|6 years ago|reply
I've argued for a while that they need to do, as part of their services push, is a "cloud compile" service. I know they want to sell hordes of Mac Pro boxes to devs, but what a cool way to open up development (like, on the iPad). Write code, save in iCloud Drive, tap "compile my app". It handles all the signing and so on, and then boom, it's on my home screen. You limit distribution to your devices at first - maybe you still need a Mac to sign it for everywhere distribution, but you let any device you own run it. You can share source via the usual open-source methods, since everyone just needs to get the code onto their iCloud Drive to build it.

There's a huge number of moving parts to get an MVP and we mustn't cannibalize desktop and laptop sales, but it seems like an obvious part of their services push AND "make the iPad a 'real' computer".

[+] nickhalfasleep|6 years ago|reply
The day they provide this, is the day they are clearly signalling the end of macos.
[+] sillyquiet|6 years ago|reply
Would be good for testing on device I suppose, but ooooh, I am not too sure how pleasurable coding on a touch interface might be, even with physical keyboard. Also, I would hate to de-incentivize one of Apple's remaining motivations for paying attention to their non-mobile hardware!
[+] ksec|6 years ago|reply
I am willing to bet nearly half of their Mac Sales relies on Xcode. There are over 20M iOS Developers, likely more assuming not everyone publish on App Store.

Which is one reason why Mac's user number are growing ( slowly), developers have no choice but to buy a Mac if they want a pieces of the App Store revenue.

And one reason why Apple completely neglect the Mac, because it will continue to sell even if they have crappy keyboard and Touch Bar. I could only wish they do something about the keyboard after Oscar winning Director Taika Waititi blast about their keyboard.

[+] dep_b|6 years ago|reply
There's so much Next-y stuff left in Interface Builder that you can forget about using anything but SwiftUI if they would port it. It was a separate application for most of it's life. The build chain already exists thanks to Playgrounds, so it's down to the file system / build settings / text editor part to be ported.
[+] IOT_Apprentice|6 years ago|reply
Probably not until you see ARM Apple laptops. Even then, I'd imagine they want you to buy that mac to do development. A better feature would be to have hypervisor on the Ipad Pro and be able to spin up linux or ARM based macos.
[+] gumby|6 years ago|reply
I don't understand: what would be the advantage?
[+] lowdose|6 years ago|reply
This is similar to asking Apple if you can summon Alexa instead Siri on iOS. Not going to happen.
[+] fmakunbound|6 years ago|reply
WTF would you want that for? I'm pretty sure the iPad is not designed for general purpose computing.
[+] qubex|6 years ago|reply
The functions that needed to be removed have already been removed. What remains is comes already pre-loaded on your iPad with iOS/iPadOS. It’s called ‘Notes’.

The functionality removed was file management, version control, compilation, building, and interface design. All the rest (text editing) is still already there.

Ha ha, only serious.

Seriously, I doubt Apple is close to allowing a compiler to run on an iPad.

EDIT: Apparently a sense of humour is not a common attribute around here.

[+] haunter|6 years ago|reply
Ofc Google had a similar project (with Javascript) but they scrapped it back in November... It was even available on Steam

https://github.com/googlearchive/gamebuilder

http://web.archive.org/web/20191017085801/http://store.steam...

You can still download the last full build (easier than compiling on your own) and it's actually really fun https://github.com/googlearchive/gamebuilder/tree/master/bui...

I pretty much hate when they abandon things like that

[+] mattnewton|6 years ago|reply
As a counterpoint, it’s labeled as “This is not an officially supported Google product.” Maybe this isn’t enough to stave off brand association?

Would you rather they never allow engineers to release it at all? When I worked at Apple, that was the fate of any internal effort or pet project that did not receive full executive buy in, and as an engineer I badly prefer the ability to open source projects in whatever state they were left, to be useful to anyone who wants to pick the bones or start something similar.

Disclaimer: I work for Google, but my opinions are my own.

[+] SlowRobotAhead|6 years ago|reply
It’s not really the same as a learning tool, but Google has FlutterPad [0] which is an online playground for Flutter app development.

Which if you’ve never played with, it’s extremely easy to see how Flutter and Dart work. Most online tutorials can be completed right in FlutterPad. So Google does know people want this, just seem to care more about other things right now.

[0] http://flutterpad.com/

[+] blondin|6 years ago|reply
they are conceptually different things.

i started exploring swift a few weeks ago and these playgrounds are quite handy. for python programmers: it's like a jupyter notebook but with outputs on the right & auto evaluation.

it's a generic instant feedback tool for swift but deeply integrated with xcode. i think, what apple did here is simply decoupling it from xcode. this is huge because swift is quite powerful and a complex language already. i am curious what direction they take this.

[+] technoplato|6 years ago|reply
I’ve been a developer for about 8 years now and have even already learned a decent amount of Swift.

I still had a blast getting the adorable character (Byte-) to navigate around the puzzles.

They even get into some simple yet cool path traversal algorithms that I’m sure grow in complexity if you keep going.

I’m going to download these and have a lot of fun with them.

Would love to see this kind of paradigm evolve into more complex domains.

[+] 3fe9a03ccd14ca5|6 years ago|reply
These types of things really are gateways into computer science. I’d like to see it grow too, because early adoption really does set students apart.

I wonder how many top students in compsci programs used to do things like install and tweak Minecraft plugins when they were younger.

[+] donatj|6 years ago|reply
QuartzComposer was the best playground. I really wish they'd give it some love.
[+] jawngee|6 years ago|reply
Really, QC was one of the cooler things Apple has done since HyperCard.

I wrote a video editor that allowed you to use it to build plugins with it: https://vimeo.com/121663242

Unfortunately, life got in the way of finishing it.

[+] jedberg|6 years ago|reply
My daughter has the Osmo, which has a coding challenge. It's very similar to this, except it's just arrow tiles and jump tiles that you lay out in front of the iPad and then the character moves the same way.

I'm going to have her try this (she's five) and see if it's too hard since it requires reading (or perhaps it will force her to improve her reading skills!).

[+] jacques_chester|6 years ago|reply
Apple have been hiring a number of developer relations and community relations folks from Kubernetes-land lately; my suspicion was that they were planning to create some kind of public platform or runtime service and wanted well-positioned ambassadors.

Maybe this is it.

[+] tempodox|6 years ago|reply
This is nice, to be sure, just too bad it's only for Catalina.
[+] zelly|6 years ago|reply
I really wish there were stuff like this for more advanced topics. Where's the gamified "write a compiler" course?
[+] favorited|6 years ago|reply
There's the nand2tetris course, which isn't exactly gamified, but it's a project-based course where you learn hardware fundamentals and assembly as you build a Tetris clone.

https://www.nand2tetris.org/course

[+] A4ET8a8uTh0|6 years ago|reply
I visited Apple store to get wife an Apple watch ( I tried to dissauade her, but it was what she wants ) and played with the Playground toys.

Neither my brother's nor my cousin's kids are ready age-wise, but it seemed like a ton of fun. I would love to be a kid today.

[+] mark_l_watson|6 years ago|reply
You might change your mind about the Apple Watch, especially with a data plan so you don’t have to carry your iPhone when going out and about.

Your wife will need AirPods to squeeze all the functionality out of her new Apple Watch; required for playing music, pod casts, audio books, and more pleasant phone conversations using the watch.

My wife and I have a ton of Apple gear and we agree that the Apple Watch is a game changing product. It is so convenient for a lot of supported things to not have to get your iPhone.

[+] m0zg|6 years ago|reply
They'd probably be watching YouTube nonstop, like all the rest of the kids though. There are downsides to being a kid today, ones that kids don't even realize are downsides.
[+] adriansky|6 years ago|reply
Looks very nice! It almost made me want to learn Swift.

The only thing is that it's used only on iOS systems. If I'm going to spend the time to learn a new programming language, I'd like to use it everywhere like I do with JS.

[+] melling|6 years ago|reply
The Mac app "syncs" with the iPad app. That's useful!

I'm writing a Swift Cookbook on Github for anyone who's trying to come up to speed on Swift:

https://github.com/melling/SwiftCookBook

Trying to be more functional with my Swift:

https://github.com/melling/SwiftCookBook/blob/master/functio...

I'm also working through Joel Grus' Data Science from Scratch book, but trying to rewrite the examples in Swift. I'm only a few chapters in:

https://github.com/melling/data-science-from-scratch-swift

Things I'm doing sitting on my couch with my iPad on the arm and the book in my lap.

[+] gumby|6 years ago|reply
> The only thing is that it's used only on iOS systems.

It's also used on the macOS, which is kind of the point of this HN posting.

In the magnitude of using a given platform, learning the language is a small part; the APIs and tooling will be a larger effort. If you already know those things for the iOS, the jump to macOS will be less.

[+] dmix|6 years ago|reply
Is there a good age to start introducing stuff like this to kids? My niece is 7 and seems to have the personality that would be perfect for a programmer.

But I don't want to rush her into stuff like this when she's still a kid who should be having fun.

I was thinking around ~10 would be the ideal time. But I'm not a parent and know little about kids and childhood development.

[+] Jtsummers|6 years ago|reply
The main thing is exposure + motivation. I learned to program about age 8 (not well, mind you, but that's when I started) with BASIC. We had a Tandy 1000 at home, and math textbooks had BASIC listings at the end of sections/chapters at the time (late 80s, early 90s). I was motivated to try the things out, my dad provided me access to the computer (showed me how to get to the command prompt, launch BASIC, open, save, and edit files, and run programs). He didn't do much beyond that (he hadn't programmed in 10 years or more, in college), but giving me access was the critical element.

If she's not interested in the motivating examples, like I was with the math-based examples, then she likely won't stay interested or engaged. So find something that she's interested in and can write her own programs (or program extensions) for. It could be more game-like stuff (controlling a character or bot on screen and having it do something), simulations, drawing (think Logo's Turtle Graphics or fractals), or something more physical (arduino + LEDs or servos controlling something).

And don't pressure her. Once she has access, and knows she can ask for help, if she's interested she'll pursue it. If she shows some interest but has little self-motivation, maybe keep providing little widgets or gizmos or games and inviting her to help out, but only occasionally.

[+] GordonS|6 years ago|reply
> My niece is 7 and seems to have the personality that would be perfect for a programmer

I've worked with all sorts of good programmers, but now that I think about it, I don't think there is a "type"?

Curious what you meant about this?

[+] RantyDave|6 years ago|reply
Start with scratch. Mine could do scratch at 7.
[+] plg|6 years ago|reply
Honest question: to what extent is this a fancier-graphics version of Logo from the 1960s? (you know, the little turtle with which you can draw shapes, by using commands like pen down, pen up, move, turn, etc).

Does swift playgrounds teach one other stuff, in particular stuff relevant to the MacOS or iOS API?

[+] hhas01|6 years ago|reply
Logo’s a Lisp. Swift’s an Algol. The latter are much more complex, and also much less expressive and customizable; alas, thanks to C they’re also firmly entrenched as the status quo. Logo emphasises compositional thinking; Swift Playgrounds algorithmic hoop-jumping.

Ironically, Apple did do a Lisp[-in-Algol-clothing] back in the 90s—Dylan—but abandoned it when NeXT took over. Shame. Closest thing since then was the “Objective” part in Objective-C, but that was always a bit smoke-n-mirrors (since it’s still C at the bottom) and is slowing going away now in any case.

I do not think Swift is a good K12 teaching language (it’s a nicer C++, roughly on-par with Java in complexity), but Apple’s goal here is to create lots of new (and preferably locked-in) iApp developers, not raise talented independent CS students†, so that’s not a problem for them.

Real-world Swift App development also gets varying degrees of ugly/tedious/painful when dealing with BSD/Foundation/AppKit/UIKit idioms and APIs due to the impedance mismatch between Swift and Obj-C worlds, so the sooner it has its own native APIs for everything the better. I don’t think SP can really prepare anyone for that tangled mess, though if/when SwiftUI is fully ready for primetime I can see SP boosting that. (Whether SwiftUI itself is particularly good remains to be seen.)

--

(† Mind, most K12 and college “computing science” courses nowadays are really “software engineering” and not really CS either; and even SE can be a stretch considering how much software today is garbage.)

[+] madeofpalk|6 years ago|reply
Swift Playgrounds is essentially an interactive Swift REPL that ALSO ships with some prebuilt learning material, some of which is "fancy logo".
[+] gigatexal|6 years ago|reply
Finally! I’ve been waiting for them to do this.
[+] skyfaller|6 years ago|reply
Has anyone read through the "Swift Playgrounds 3.2 License Agreement"? It's kinda long.

Would it have killed them to use a standard open source license like MIT or Apache 2.0? Don't they want as many people as possible to learn their pet language?

[+] misiti3780|6 years ago|reply
Is the get button disabled for anyone else in the mac store?
[+] elpakal|6 years ago|reply
yea but is it written in Swift is what i wanna know
[+] favorited|6 years ago|reply
If you download it and run `nm /Applications/Playgrounds.app/Contents/MacOS/Playgrounds | grep "_\$s"` from Terminal, you can see there is lots of Swift in there.
[+] inviromentalist|6 years ago|reply
Any chance Apple would make it possible to compile an iOS app without giving Apple any money?

I want to support my customers, but I don't want to support anti competitive FAANG

[+] slashblake|6 years ago|reply
Real missed opportunity not calling this "Swifty Swift"?