iPhreaks

The iPhreaks Show is a weekly group discussion about iOS development and related technology by development veterans. We discuss Apple, tools, practices, and code.

Subscribe

Get episodes automatically

180

180 iPS Swift Playground Books with Ash Furrow


0:15: Introduction

5:45: Capabilities

  • Customization
  • Coding

9:45: Comparison to Apple

14:50: Who are the books for?

18:00: The user experience

  • Keyboarding
  • Auto-complete

23:15: Playground Book tool

  • Ruby
  • Open-source project

Debugging experience

Picks:

Postman Mac App (Andrew)

Turn Season Two (Rod)

Rod’s Blog (Rod)

Dark Matter (Ash)

This episode is sponsored by

comments powered by Disqus

TRANSCRIPT

Jaim:            Hey everybody, welcome to the episode 180 of the iPhreaks show. Today on our panel we have Rod Schmidt.

Rod:         Hello from Salt Lake.

Jaim:            Andrew Madsen.

Andrew:   Hello, I’m also at Salt Lake City.

Jaim:            Our guest today is Ash Furrow. Ash, can you tell us a little bit about yourself?

Ash:          Sure. I’m coming from New York City. I’m a software developer with Artsy, here’s how to play Playground Books.

Jaim:            Very cool. We’ve had other people from Artsy on the show. [00:00:51] was on, at least once. We had him on a couple weeks ago or a few weeks ago. Cool organization with a lot of open source stuff. Can you tell us a little bit about the Playground Books.

Ash:          Essentially, if you take Playgrounds and Ex Code setting, and move them onto an iPad, you get Swift Playground. It’s a little confusing with the [00:01:18], Playgrounds on Ex Code and swift Playgrounds are on the iPad. Basically, Playground books are an iPad, swift Playgrounds for iPad learning material that authors can customize really heavily or just a little bit in order to provide some really interesting learning experiences for readers who are learning how to program for the first time or learning how to use a new class or a new type of programming. They’re really versatile and I’m really excited about it.

Jaim:            It’s very cool. What type of people are going to be excited about this?

Ash:          A million people I’ve seen who are really excited about them are other authors which is, I think it makes a lot of sense especially if you work with the traditional publishing industry and you‘ve published a book or an eBook. It is very difficult to get something published in the traditional world. With Playground, so far it’s kind of like a wild west where authors are just building their own content and distributing it themselves. There isn’t really a distribution network provided by Apple yet so that’s a different means to be seen and if they’re going to provide one. It’s also a much more mercy of learning experience than reading from the book where you can actually read along, see the code, modify it, run it and see the results of your code right away so you don’t have to have this large cycle between learning something and trying it out. It’s very immediate.

Rod:         Are there many books available yet? Where do you get them?

Ash:          There are none. It’s kind of a shame actually. Apple’s so far didn’t want this really providing books that they have there, learn to code books but they’re very much for an introductory audience, someone who has never programmed before. Right now, the only way to get a Playground is basically Airdrop it onto your iPad. There isn’t a bookstore or iBookstore for Playground books yet which is, I’m kind of ashamed. I’m hoping that as more people will generate more content for them, that will be something that Apple provide ideally.

                It’s possible to just distribute to, there’s number of e commerce so it’s out there that it can distribute the goods for you. But I think Apple providing something would be fantastic. I think it’s a bit of a chicken in the egg. It’s twitch right now where we have authors who are sort of skeptical about how to distribute these. They’re excited but they don’t want to put a lot of reference or something to building a book that is difficult to distribute. They’re waiting for Apple to do something that I can think Apple’s waiting for authors to do something to show that there’s enough interest to warrant this.

                It feels like a little bit of a [00:04:39] but Apple’s also trying to do so many different things that it could just be that they haven’t gotten to it yet which is what I hope. I really hope that we got something soon to distribute these and for learners to find books, discover them and download them a lot easier.

Jaim:            If we have a book we want to download, what format can we view the book? Do we need a Mac? iPad? How does that work?

Ash:          You really do need an iPad. You can open the books on a Mac but it’s essentially just a folder that you can open up the individual Swift files. It is a little of frustration trying to author one of these. I’ve been working on a tool with a few other developers that actually generate Swift Playground Books from ex Code Playgrounds. Basically, you’re able to write code in ex Code that is very familiar and very easy to work with and then run that Playground through this tool that I’ve built. You provide a little bit of metadata around it like what the book cover is supposed to be, what the deployment target is, the chapter names, that kind of stuff. It’ll actually go through and generate a Playground Book that you can then Airdrop on iPad.

                My hope is that, with building a tool like this, that makes it a lot easier to go from just having something in an ex Code Playground, turning it into a Swift Playground Book. That’ll encourage more authors and content creators out there to create Playground books. I think it’s a really unique medium for learning how to code and learning how to code in new ways or using different frameworks. I think it would be a shame not to take advantage to this opportunity and create some really compelling educational content from the Swift Playgrounds platform.

Andrew:   I want to step back a little bit. Can you tell us a little more about what Playground Books allow you to do being on, what just regular Swift Playgrounds on the Mac. I know you can open up the Swift Playground apps on the iPad and start writing Swift code and a new Playground. What capabilities do Playground books bring that are not possible otherwise?

Ash:          I mentioned earlier that authors are able to customize things only a little bit if they want to or they can customize everything. Let’s start on the easy end of that spectrum. The easiest way to customize things is by dragging in existing assets if you want to, images that you want to use or other resources. There’s also a glossary that you can include which is pretty useful. That’s actually a feature that we just recently added to the tools. I’m pretty proud of that.

Beyond that, you can also include code in a scope to a page or a chapter or the entire book that is accessible to every page or chapter or everything. What that does is it’s actually hidden from by default so they can go and look at it if they want to, to see how it works.

                By hiding some code that the learner doesn’t have to know about yet, you can really use them into an educational experience where they don’t get distracted by extraneous details or boarder plates which is really great. You’ve got [00:08:50] code among chapter pages or even among chapters and you can also hide individual snippets of code within your page. You can also tell the user, “Okay, this is the code in this page. You can’t edit it except for this one little bit.” Say it’s an integer that defines like [00:09:10] building a collection book and I want to show how you can increase the space between cells. I can say to the Playground only in this integer that represents the space in between the cells, only that is editable. Users are going to get a pop up for that.

                You can also provide things like hints and suggestions for code that is going to be inserted later on so the user gets in a, I don’t know if [00:09:36] there’s a little autosuggest bar and you can actually have a little bit of influences to what sort of suggestions that that has. You can really guide the learner in a really unique way that you just can’t do with a traditional book or either in eBook and that’s what really excites me about it. You can go even further than that. There is a cross process communication capabilities.

                You can have an application running in another process that takes control of the running code for you. If you look at a Swift Playground, you’ve got your code on the left hand side and you’ve got the results of your code on the right hand side. Other process can take control of the result for you. Your code is no longer being compiled and run and the results just being rendered. Instead, your code can be compiled, run and then send messages to them in the process. For example, you’re learning to code book where you type in commands to have it move forward or backwards and then it sends it over to the other process and executes them over there.

                You can have the sort of conversation back and forth whether there is a program running in the results view and the learner is communicating with that program through code which is, I can’t think of another platform where you get that service interactivity.

Andrew:   That’s really cool. I’ve played with the learn to code book that just comes with Swift Playgrounds with the little character bite that you we’re talking about. You can move them forward and collect gems and whatever. I’m curious to know if you think or if you know if Apple is using any sort of Apple only or secret sort of stuff to do that or they’re just using all of the same capabilities that are available to anyone with Swift Playground Books.

Ash:          I was curious about the same thing actually so I downloaded the learn to code Playground Book and Airdropped it to my Mac and do the look and it’s just using the regular APIs, everything that it’s doing is any author is capable of creating that same experience. It is a lot of work to create it though. They are offering content that sort of really high quality, I think in order to try and set the buyer for the best kind of Playground Book can look like. Their Playground Books use 3D animations and all kinds of things that I’m not very fluent in so I won’t be able to create something that polished.

                That’s sort of touches on the lack of tools again that Apple hasn’t really provided. In my opinion, they haven’t provided enough tools to help authors create content for this platform. That’s sort of where my tools tries to fill in. It’s a struggle right now because if you, as an author see this really amazing content that they’ve got from learning how to code and you want to go build something like that, there’s some documentation but it’s very difficult to get from zero to one on building a Playground Book and that’s a real shame.

Andrew:   It encourages me that they’re not using private API or stuff that is not available to other developers but I think you’re right. Apple obviously has resources beyond what the average person who might be interested on doing a Playground Book has in, good 3D artists, game designers and whatever working on this. I certainly hope this is the start and not the end and next WWDC there will be all kinds of new cool stuff and the situation will just get better and better for those that want to use the stuff.

Ash:          I think so too. I’ve seen a lot of other open source projects have Playgrounds available so you can download the RxSwift Playground and play around with it. I think it’d be really cool to have stressing open source project at Playground books. You can download Playground book and start experimenting with the new framework like RxSwift or Alamofire or anything. The really amazing thing, for me, about Swift Playgrounds in general in that, they have access to all of UI Kit and all foundation and they can access the devices, Bluetooth sensors and cameras. You can prototype an entire app in Swift Playground if you want to. I think that you’re right that this is a start and hope it is just a start because there is definitely a lot more capabilities out there that we have yet to see.

Andrew:   I think I’ve heard some other people mention this. I’m a lead instructor for an iOS program at a boot camp, teaching how people how to do iOS programming. This is something that’s really attractive to me. But of course, all of the work we’re doing is on Mac, in Ex Code right now and not everybody has an iPad. Sure, it would be nice if these Playgrounds worked on the Mac too, Playground Books, I mean.

Ash:          I agree. That’s something that we would like to do is, have the ability to translate back from Playground book to a Playground and were working on something that’s a step towards there. There’s only three or four of us working on this project and it’s sort of comes and goes. You’ve worked on open source things, you know at sometimes the journalist have the time that you want to be able to give something. I hope that we more people on this from Apple. I’m going to try that as better talk next week here at the City University of New York where I’m going to be describing the History of Swift and some of the basic syntax and capabilities in the language. I’m hoping to do it on stage with an iPad to do something like live Swift Playground coding. I don’t know if anyone has ever done that before but I definitely want to give it a try and see how it goes.

                These young impressionable minds and not to know that if they have an iPad thing around or I can [00:16:42]. But if they have an iPad, then it’s more than capable of being something you use to learn to program in Swift or experiment with or something from.

Andrew:   That’s cool. I was actually going to ask you personally what you want to use these Playground Books for other than obviously you’ve explored them and written a tool you were talking about. Who do you hope to help learn?

Ash:          I think the big one would be like other author Swift already created existing Playground, I’ve done books or blog posts. For example, if a guy has written a book on UI collection view, I’d really like to take that and turn into something like a Playground Book where you can learn how to write UI collection view on an iPad. This is where I think like having something like a Playground Books on Ex Code would be really useful because not everyone is like, “Download Playground Book and have put it on their iPad.” I think for sort of scale down content, it’s maybe not entire book but an introduction to UI collection view or an instruction to auto layout.

                Those sorts of topics would be, I think I’m really cool and be beneficial for the people who are just learning the language and to see how they can take baby step towards building actual applications in Ex Code. I’m really excited because, take the auto layout book for example, you could have secrets codes running to actually show the auto layout constraints and visualize someone’s screen in a way that you wouldn’t be able to do with regular book.

                I’m a little bit frustrated by the lack of support from Apple but that’s been like a common refrain so far with me saying, my God, yes, it’s great but it didn’t quite go far enough, I’m not quite capable enough and hoping to see all progress on that soon.

Andrew:   I think they’re taking this whole learn to code initiative quite seriously. I have a couple friends who recently left the real world and went to Apple to work on it. They’re scaling up.

Ash:          I hope so. That sounds great if that’s the case. Fantastic.

Jaim:            If you’re using one of these books to learn to code, what’s the experience like? Like doing an actual typing? Like Swift coding?

Ash:          Yup. The learning [00:19:41] on this is really shallow and nice. The autocomplete part at the top of the keyboard is going to be there for most things that you want to do if you want to insert like a function call or image [00:19:56] that sort of thing like you can, as an author you can say, “I want this to be recommended to the user if you’re just sort of like free flowing typing.” There are onscreen keyboard that Apple has created for Swift Playgrounds, it’s quite nice. If you’ve ever tried to write out code on the regular iOS keyboard, it can be a little tedious but they’ve got a lot of thing like apprentices and brace brackets and I think even there’s a button for semicolon where instead of just having the button you tap [00:20:33]. It’s really a nice gesture, I got used to it pretty quickly. It’s very easy to do.

                If you have a physical keyboard you can attach to your iPad, either you’ve got an iPad Pro or one of those iPad cases, that’s another option as well if you really need the physical keyboard. I’ve used both, I haven’t missed the physical keyboard too much when I need to sue the onscreen one. You’re writing code, you’re getting recommendations, it was kind of cheesy during the WWC video. They really made a point to show how powerful the auto complete was or this gesture results. But, I’ve tried to pay attention to it and it’s very good. It’s [00:21:22] of different functions on different types that you’re working with. If you don’t or you tapped the suggestion for dot, then you’ll get a list of functions on that type and the most recent used ones are first.

                It’s fairly easy to really get to a flow on an instance. I think getting learners to that flow state is really important for educators in general and it’s something that is enabled by the tools.

Rod:         I tried it online on iPad Pro keyboard and just typing in the code felt really nice. Frankly, code completion is better than ex Codes. Can we get the Swift Playgrounds theme like collaborating with the Ex Code theme a little bit? I think that solve a lot of problems.

Jaim:            If you’re a developer trying to get your book around some esoteric topic? What control do you have over the autocomplete? How do you add your other things that may not be in the [00:22:29] one?

Ash:          There are specially formatted comments that you can insert into your code so they aren’t rendered to the user when they actually see them in the Playground book but you can see them inside Ex Code when you’re offering the book, if you’re using this tool. Basically, you just say, “This is what I want to be at the beginning of the autocomplete list.” Or you can say, “Only this region is editable and only this should be suggested as autocomplete result.” It’s a fairly written entry, you don’t have a ton of capabilities. It is basically just specialized comments.

                    There’s not a ton that you can do with that but it’s also, say you’re running out, you’re teaching someone how to write functions and you have the function name as the editable part. You might notice that or recognize this entire from Ex Code if you have the less than number sign and then some text and then the number sign greater than. It’s almost like an HTML tag. Everything in between the typing, editing and ending is the place folders. When you go and you hit enter on autocomplete in Ex Code and it fills a bunch of place folders in. Under the hood, Ex Code is using the same syntax for place folders in Ex Code.

                Swift Playground is on the iPad, are using for editable code place folders. You can combine place folders and telling the Swift Playgrounds which regions of the code are editable. I’m hoping to see more capabilities figure as well because it would be nice to have especially more documentation around this. Most of what I’ve gathered so far has been just me and a few other people squirting Apple’s Playgrounds as well as the documentation trying to put things out on our own. There isn’t comprehensive set of documentation for what’s capable, what the Playground books are capable of. I think right now, the source code of our tools probably the most concentrated bit of documentation that exists right now.

Jaim:            I want to hear a little bit more about your tool which is called Playground Book. I’m particularly interested in how easy or difficult it was to get it working but also what it does.

Ash:          This started, I was at a conference in Seattle, I was just curious around the iOS [00:25:57] beta and I’ve been playing on Playground books. I’d had a hard time with it so I thought, if you’ve created a Playground book, the next step is to Airdrop it onto your iPad and actually use it. But the iPad lint the Playground Book and if it doesn’t validate crackly formatted and the folders structures are quite right then it just won’t open the book. I thought I’d write a linter for this. I turned to Ruby because I’ve been doing a lot of review lately and there is just a ton of really awesome libraries out there for working with [00:26:33] files which exist in the book format, for working with file system, that sort of stuff.

                I started out there, I made a linter and then later on [00:26:44] said, “It’d be really cool if you just write in Ex Code and then generate the Playground book instead of having to craft it yourself.” That’s a way better tool. I was embarrassed at that point of having a lint instead of a generator. The tool sort of pivoted a bit but now it renders books from Playgrounds. Right now we have this, you write a chapter in a single Playground file and then if you named them the same chapters name and the tool just works and then you delineate pages by having a quadruple slash comment so slash, slash, slash, slash and then you page your name and you divide your pages that way.

                Basically, what’s it going to do is split your Playground contents based on regular expression that looks for this quadruple slash comments and then divide it the pages from there. You use markdown, in line mark down just like you normally do for [00:27:58] rendered markdown inside of a regular Ex Code platform. You use the same format for Playground books and there is this special glossary you were asking. You can mark down list to glossary link slash, slash then some term. The tool is also going to take a look through all of your glossary links. One of the capabilities of the Playground books is to point to the first time in a book that a term was used. Getting that working was a lot of fun.

                It’s all been unit tested which is really fun for me. I’ve wanted to explore more capabilities of tester and development on relying on the [00:28:43] cycle for a while. But, if you’ve worked with Swift and Ex Code, you know that it takes amount of time to compile them and run your tests. I thought, Ruby, they’ve got a lot of tool on your testing and it’s been a lot of fun because I’ll have a tool running on my command line that just watches for change to files and then rerun the tests that touch that file. I get a constant feedback cycle of, if the code I’ve written works or not. It has been a lot of fun.

                The big thing I wanted to mention was that, it turns out that Ex Code Playgrounds have pages as well. I didn’t know that but it’s kind of weird that Ex Code Playgrounds has pages and Swift Playground books also have pages but they’re still not compatible with each other. We’re working on an open port request right now to move from the quadruple slash format to, basically, you’re just creating the pages and you’re on Playground and those pages become the pages of your book. It’s a lot more one to one of a translation.

                It’s been a lot of fun because, I just started this as an open source project, I think I wrote a blog post about it. I’ve had not just [00:30:17] trying to send most of the time in sort of projects but developers from San Francisco, Australia, and Germany come in and help with us and they see the value of the tool and it’s a language that you don’t normally, Ruby isn’t like a super common language among iOS developers or people who will be familiar with Swift Playgrounds. To see other people come in and improve the code that I’ve done and improve the tool that I built is been a really good process.

Jaim:            It’s very cool. What’s the debugging experience if you’re writing a Playground book?

Ash:          The debugging experience is kind of interesting. When you make an edit on the iPad, it doesn’t actually modify the source of your Playground book directly. Instead, it places the change a file inside an edit folder so you can actually distinguish when you’re, if you use this tool and you take your Playground trying to Playground book, put on the iPad and you go through the content and realize that some things don’t look quite right or you need to make some changes. You can make them on the iPad and then when you’re back on your Mac, take a look at just the edit folder to look at only the things that have changed and the things that you want to change in your source ex Code Playground. There is not a debugger built into the Swift Playgrounds tools. You don’t have the same debugging capability as you do on the Mac but it’s still [00:32:13] device.

Jaim:             How is the changes you make in the edit folder, how is that communicated back to the Mac?

Ash:          Not well. You’ve got to just Airdrop the entire book back unto your Mac and take a look in there and it just has the entire file, it’s not a DIF or anything like that unfortunately.

Jaim:            No magic involved.

Ash:         No magic. Configuration over convention, I guess. I think if I had to read the tea leaves of Apple, I think that they put a lot of work into getting the Swift with Playground tool ready for WWDC and then shifted from working on the tool to working on the content for the tool after WWDC. We saw the learn to code books coming after that.

Rod:         Do you know how the code is executed? When I tried it, it seem pretty fast. Is it doing a rebel thing or is it actually compiling it? Do you know?

Ash:          That’s a good question. As far as I understand, it’s compiling the code and running it natively which apparently breaks the app store review guidelines. But, I’m pretty sure Apple does whatever they want on their applications. I think someone disassembled parts UI Kit and found checks disabled if you have certain bundle identifier looking for the iBooks app then it just doesn’t worry about certain checks that normally would crash an application. It’s really weird.

Rod:         I was wondering Ash where you saw this going? It kind of reminds me a little bit of HyperCard where you could write your own software inside the tool itself and publish it.

Ash:          That’d be super cool to see that sort of capability. HyperCard was a little bit before my time but I’ve heard nothing but good things about it. There’s been a little bit of a push back on a Swift Playgrounds which is really unfortunate. A lot of developers who learned to buy, they were dropped into HyperCard or dropped into some environment that was unfamiliar to them and they just had to mess around and through trial and error, they learned how to program. That experience is very [00:35:08] and to see Playground books come, I think that intimidates a little bit because it holds the learner’s hand in a way that they didn’t have when they will learn to code.

                They’re resisting the sort of Playgrounds book future because it’s not way that they’ll learn to code. It’s really funny because the Swift Playground books remind a lot of people of HyperCard in a really positive way but they also contrast with HyperCard in the [00:35:45] people are worry about.

Jaim:            Very cool. We’ve [00:35:59] tons, it’s a really cool technology. I’m looking forward to see where it goes. Apple’s put a lot of their energy behind it. It’s still pretty much in infancy as you point it out. Thanks for coming on the show. We’re going to go to the picks. Andrew, do you have pick for us?

Andrew:   I have been trying to come up with the pick and struggling but no, I do actually have one. I’m actually going to pick an app called Postman, it’s a Mac app. I think they also have some sort of web version which I’ve never actually used but it’s a pretty useful if you’re working with a rest API to create request and explore the API and debug it without actually having the right code. For me, writing code means writing Swift and then the CRL session code. This is a good way to test things and figure things out without having to actually start writing that kind of code. That’s my pick.

Jaim:              Pretty cool. I’ve used Postman for years starting when I was at Chrome Extension which I think is going away towards the app that I call Mac app. It’s a great tool. Rod, what do you have for us?

Rod:         I’m going to pick Turn season 2 which I’m enjoying. That is about the spies doing the revolutionary war. I will also pick my blog @rodschmidt.com. I’ve got a series of post about why it’s not a good idea to put a [00:37:41] access there from everywhere. If you’re interested in that, check that out.

Jaim:              Just don’t to it. Ash, do you have any picks for us?

Ash:          I’ve been watching a new show called Dark Matter with my wife. It’s by a lot of the same producer, writers, directors of Stargate SG-1 series. If you’re a fan of those shows, definitely check that on Netflix.

Jaim:              Okay, very cool. That warps up. Ash, thanks for coming on the show. I’m excited to play around with the Playground Books. It’s a very cool technology. We’ll see you all next week.

x