Playgrounds 7: In which I *finally* get the keyboard

Swift Playgrounds offers a smart, programmer-centric keyboard. Symbols, numbers, and common programming punctuation are included on the main keyboard.

Screen Shot 2016-06-24 at 11.35.29 AM

To access an alternate key, tap and then either drag down for single item keys, like qwerty’s numbers, or down-and-left / down-and-right for two-item keys, like fghj’s brackets and parentheses. Release your finger with the gray replacement key shown. Playgrounds uses smart insertion, so you may sometimes add a single bracket or you may add a bracket pair, depending on context.

Try these steps to add a line that says “let x: [Int] = []”:

  1. Tap the “let” bubble in the top keyboard accessory view. A template appears that says “let name = value”, with name highlighted.
  2. Tap x. This replaces “name”.
  3. Pull down on the “k” key until it turns into a colon and release. Playgrounds adds a colon and a space.
  4. Pull down-and-right on “h” until it turns into “]”. Release. Playgrounds adds a square-bracket pair (“[]”) and places the cursor in the middle.
  5. Tap Int on the accessory view.
  6. Tap the value placeholder in code.
  7. Repeat step 4 (Pull down-and-right on “h” until it turns into “]”. Release.) to add an empty array literal.

In addition to this sweet, super-convenient programming style, you can also connect a Bluetooth keyboard (or use your computer with a program like Houda’s Type2Phone), dictate (handy for populating comments), or switch to a standard iPhone numeric keyboard by tapping either of the “.?123” keys. You can even use Swift-supported emojis:

Screen Shot 2016-06-24 at 11.42.05 AM

After declaring the dog-cow variable, it appears in contextual completion lists like any other symbol:

Screen Shot 2016-06-24 at 11.46.52 AM

Izzy notes: The 12″ iPad doesn’t use it because the larger keyboard has an extra row of numbers/symbols. You can tap + hold or swipe up on the numbers to get the symbols without having to use shift.

3 Comments

  • I agree. After my snarky comment on your last – admittedly obscure and even nitpick post – I need to compliment you on what the playground keyboard is the start of. Good post.

  • For some reason I do not have the programmer-centric keyboard. Any spesial way to enable programer-centric keyboard.

    • Can you grab a screenshot for me?