Guides and Sample Code

Developer

Playground Book Format Reference

PlaygroundBluetoothConnectionView.State

The states that tell users how to proceed when connecting to and switching between peripherals in a playground page.
接続および周辺機器間の切り替えの際に、どのように続けるべきかをプレイグラウンドページにおいてユーザに教える、いくつかの状態。

The example below shows how to use the different states as part of adopting the PlaygroundBluetoothConnectionViewDelegate protocol.
下の例は、PlaygroundBluetoothConnectionViewDelegateプロトコルへの採用の一環としてこの様々な状態をどのように使うかを示します。

  1. extension PageViewDelegate: PlaygroundBluetoothConnectionViewDelegate {
  2. func connectionView(_ connectionView: PlaygroundBluetoothConnectionView, titleFor state: PlaygroundBluetoothConnectionView.State) -> String {
  3. // Pick a name that matches the types of peripheral your playground (あなたのプレイグラウンドがサポートする周辺機器の型に合致する名前を選びます、)
  4. // supports, such as "Robot", "Speaker", or "Light". (例えば "Robot", "Speaker", または "Light"。)
  5. let name = "Peripheral"
  6. switch state {
  7. case .noConnection:
  8. return "Connect \(name)"
  9. case .connecting:
  10. return "Connecting \(name)"
  11. case .searchingForPeripherals:
  12. return "Searching for \(name)s"
  13. case .selectingPeripherals:
  14. return "Select a \(name)"
  15. case .connectedPeripheralFirmwareOutOfDate:
  16. return "Connect to a Different \(name)"
  17. }
  18. }
  19. }

Enumeration Cases
Enumerationケース節

noConnection

The connection to a peripheral has been lost.
ある周辺機器への接続が失われてしまった。

Declaration
宣言

  1. case noConnection

Discussion
解説

The connection view title corresponding to this state should be in the following format: "Connect \(item.name)"
この状態に対応する接続ビュータイトルは、以下の形式でなければなりません:"Connect \(item.name)"

connecting

The peripheral is in the process of connecting to a connection view’s central manager.
この周辺機器は、ある接続ビューの持つセントラルマネージャへの接続処理中です。

Declaration
宣言

  1. case connecting

Discussion
解説

The connection view title corresponding to this state should be in the following format: "Connecting \(item.name)".
この状態に対応する接続ビュータイトルは、以下の形式でなければなりません:"Connecting \(item.name)"

searchingForPeripherals

A connection view’s central manager is scanning for nearby peripherals.
接続ビューの持つセントラルマネージャは、近くの周辺機器を走査中です。

Declaration
宣言

  1. case searchingForPeripherals

Discussion
解説

The connection view title corresponding to this state should be in one of the following formats: "Searching for \(item.name)" or "Searching for \(item.name)s".
この状態に対応する接続ビュータイトルは、以下の形式のうちの1つでなければなりません:"Searching for \(item.name)" または "Searching for \(item.name)s"

selectingPeripherals

One or more peripherals have been discovered and can be selected.
ひとつ以上の周辺機器が見つかり、選択可能です。

Declaration
宣言

  1. case selectingPeripherals

Discussion
解説

The connection view title corresponding to this state should be in one of the following format: "Select a \(item.name)" or "Select several \(item.name)s".
この状態に対応する接続ビュータイトルは、以下の形式のうちの1つでなければなりません:"Select a \(item.name)" または "Select several \(item.name)s"

connectedPeripheralFirmwareOutOfDate

The currently connected peripheral has outdated firmware and cannot be used.
現在接続される周辺機器は、旧式のファームウェアを持ち、使用できません。

Declaration
宣言

  1. case connectedPeripheralFirmwareOutOfDate

Discussion
解説

The connection view title corresponding to this state should be in the following format: "Connect to a Different \(item.name)".
この状態に対応する接続ビュータイトルは、以下の形式でなければなりません:"Connect to a Different \(item.name)"