26
28

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.

Swift1.0〜2.0 タッチイベント (touchesBegan, touchesMoved, touchesEndedなど) 処理の変遷

Last updated at Posted at 2015-10-17

変遷1

// Swift 1.0
touches: NSSet

// Swift 1.2
touches: Set<NSObject>

// Swift 2.0
touches: Set<UITouch>

変遷2

// Swift 2.0
UIEventの最後に?を追加

コード

Swift1.0
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { }
override func touchesMoved(touches: NSSet, withEvent event: UIEvent) { }
override func touchesEnded(touches: NSSet, withEvent event: UIEvent) { }
Swift1.2
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) { }
override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) { }
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) { }
Swift2.0
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { }
override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) { }
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { }
26
28
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
26
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?