28
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Swift] バイブレーションでぶるぶる(((( ´・ω・`)))

Last updated at Posted at 2014-12-05

経緯

iPhoneを小型マッサージ器化し、肩こりを改善したい!

準備

プロジェクトの Build Phases -> Link Binary With Libraries に
AudioToolbox.framework を追加します。

ライブラリの追加

コード

// ライブラリをインポート
import AudioToolbox

// バイブレーション
AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate))

とりあえずブルブルさせてみたい人は、こんな感じで。


import UIKit
import AudioToolbox

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate))
    }
}

あとは、whileで無限ループさせてあげれば…

まとめ

肩こりは解消されませんでした((((;´・ω・`)))

28
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?