官术网_书友最值得收藏!

How to add auxiliary code to a playground

Each playground may need a bunch of classes which are helping to illustrate the problem or a solution. There is a handy way to add a chunk of code, which is compiled once it is added or changed. This means that those parts won't be compiled each time the playground is executed. The files containing code are called auxiliary files. To add such a file, we should do the following:

  1. Open the Navigator panel (cmd + 1).
  2. Select the Sources folder.
  3. Press the + button at the bottom of the Navigator panel.
  4. Select New File.
  5. Give the new file a nice name related to its role.
  6. Add the code which you want to reuse in the playground. Don't forget to add the public scope modifier to make it visible in your playground
  7. Try to use it in the main playground:

Playgrounds can contain different resources such as images, statistic data, sound, and so on. These are placed in the Resources folder. Here is a step-by-step guide on how to add a resource (image/asset) to a playground.

主站蜘蛛池模板: 云安县| 碌曲县| 宜兰市| 台南县| 嵊泗县| 绿春县| 阳高县| 西林县| 新营市| 甘泉县| 龙口市| 贵南县| 五峰| 鸡东县| 丰顺县| 弥渡县| 佛冈县| 比如县| 澄江县| 南宁市| 德安县| 青州市| 安徽省| 清流县| 雅安市| 揭西县| 方正县| 峨边| 麻栗坡县| 泌阳县| 汝阳县| 西丰县| 页游| 剑川县| 松江区| 疏勒县| 定日县| 扬中市| 元谋县| 延安市| 沂水县|