Coder Social home page Coder Social logo

playground-readme-tutorial's Introduction

Creating an interactive readme in playgrounds

Basic playground introduction

Where is what and what is where

run.png

First open a new Playground in XCode 10. Now there are two ways in which you can run the playground code.

  1. Down at the left to run the enitre playground
  2. Or you can use the play button on the lines

inline-result.png

By selecting the box you can show the result inline, so you can see the changes you make.

The live view

If you want to see the result of ViewControllers you can set the current liveView to your viewController: PlaygroundPage.current.liveView = ViewController Dont' forget to Import PlaygroundSupport when you do this.

live-view.png

Show the assistant editor to make your live view visible

lost-live-view.png

Pro-tip: When you lose your live view you can reselect it in this drop down menu by choosing Live View instead of Manual.

Files

add-files.png

When you show the navigator you can add files to your playground

images.png

Add images to the Resources folder

files.png Add Code files to the Sources folder. Don't forget to make the classes or entenstions public!

code.png And you can use the extension in your playground code.

Pro-tip. When debugging these code files breakpoints don’t get hit, so debug them by either using print statements, or just add the code to your playground page to make full use of inspection and when you are happy with it move them to a separate code file.

Creating the README

playground-readme-tutorial's People

Contributors

marijnschilling avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.