Playground Power in Swift
Playground Power in Swift
Working with playgrounds in Swift? Here's a bunch of articles you won't want to miss.
Join the DZone community and get the full member experience.Join For Free
There’s a new article for your attention up at the official Swift blog, Literals in Playgrounds:
New in Xcode 7.1 is the ability to embed file, image, and color literals into your playground’s code. Literals are the actual values of your data represented in their native format, directly within the Xcode editor. For instance, there’s no need to type “myImage.jpg” in the editor – just drag your image from the Finder and the actual image will appear in-line with your code. Instead of showing RGB values to indicate color, the playground will render a color swatch. Literals in playgrounds behave similarly to code you would otherwise hand-author in regular Swift code, but are rendered in a much more useful manner…
So what’s new in this edition? I’ve done a back to front update to incorporate all the new XCPlayground features in Xcode 7.1 beta 3: the new liveView feature that can be used with views and view controllers (and the XCPlaygroundLiveViewable protocol that supports rendering arbitrary model objects), the new ways to continue execution and capture values, etc.
Use markup formatting commands to create rich comments in playgrounds and to document your Swift symbols for Xcode quick help. Commands include page level formatting for headers and other elements, inline formatting, and images. Playground formatting commands enable page navigation as shown in the following figure … Swift symbol documentation adds descriptions to symbol completion and quick help for symbols …
So if you’re using those legacy HeaderDoc conventions, why there’s all you need to level up!
And to finish up, perhaps a potpourri of playground posts of particular perspicuity:
Performance Testing in Xcode Playgrounds: “Playground that has a similar function to the 'measurePerformance' function in XCT.”
Core Graphics Tutorial Part 3: Patterns and Playgrounds: “Draw it in a Swift Playground, and then copy the code to a UIImageView subclass.” Or, Overlooked playground cool stuff #3: “Build, preview, and save the image to disk. Perfect for creating masks and labels.”
Swift-Diagram-Playgrounds: “Two different approaches to creating Diagrams as value types.”
Numerical Algorithms using Playgrounds: “Solve problems that don’t have an analytic solution.”
Published at DZone with permission of Alex Curylo , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.