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

What is a playground?

Straight from the file generated by Xcode:

"Playground – noun: a place where people can play."

Playground is a simple project, which can be used to practice, experiment, prototype and play with code and the underlying OS. It's easy to write some code to sketch an idea or to clarify a concept. The best thing is that you can mix text (markup) with code. Also, it's possible to use the native functions that are specific for the platform (for example iOS). This makes playground projects very expressive and realistic.

Let's create a playground and pe deeper into it:

  1. Open Xcode
  2. Select File New | Playground or simply press "Option + cmd + Shift + N"
  3. Pick a nice name—for example Swift 4 by examples
  4. Set the platform to iOS
  5. Click Next
  6. Select a place to save the file
  7. Press Create

As a result of these steps, you will have a new playground, which will only have a few rows.

The playground can contain more than one page.

In our example, we are using just a single-page playground, but if you want to express something complex, you can add another page using the + button in the Navigator panel (at the very bottom).

主站蜘蛛池模板: 天长市| 交城县| 林周县| 苏尼特右旗| 陇西县| 龙江县| 弋阳县| 曲松县| 达尔| 左权县| 石楼县| 河北省| 静海县| 绥德县| 台湾省| 旅游| 扎兰屯市| 新昌县| 新野县| 湘潭市| 苍山县| 民县| 曲周县| 永顺县| 墨脱县| 乌兰察布市| 聂荣县| 望江县| 定襄县| 申扎县| 扬州市| 拉萨市| 仙居县| 工布江达县| 樟树市| 故城县| 梅州市| 松江区| 延寿县| 新宾| 房山区|