@@ -20,8 +20,9 @@ class ViewController: UIViewController, MetaballDataSource {
2020
2121 view.backgroundColor = UIColor.white
2222
23− let recognizer = UIPanGestureRecognizer(target: self,
24− action: "handlePan:")
23+ let recognizer = UIPanGestureRecognizer(
24+ target: self,
25+ action: #selector(ViewController.handlePan(_:)))
2526 view.addGestureRecognizer(recognizer)
2627
2728 var positions = [CGPoint]()
@@ -29,8 +30,8 @@ class ViewController: UIViewController, MetaballDataSource {
2930 x: Double(screenWidth) / 2,
3031 y: Double(screenHeight) / 2))
3132 for i in 1...5 {
32− let sine = sin(Double(i) * 2 * M_PI / 5)
33− let cosine = cos(Double(i) * 2 * M_PI / 5)
33+ let sine = sin(Double(i) * 2 * .pi / 5)
34+ let cosine = cos(Double(i) * 2 * .pi / 5)
3435 let radius: Double = 150
3536 let x = Double(screenWidth) / 2 + sine * radius
3637 let y = Double(screenHeight) / 2 + cosine * radius
@@ -81,8 +82,8 @@ class ViewController: UIViewController, MetaballDataSource {
8182 UIView.animate(withDuration: 1.0, delay: 0,
8283 options: UIViewAnimationOptions(),
8384 animations: { () -> Void in
84− let sine = sin(Double(i) * 2 * M_PI / 5)
85− let cosine = cos(Double(i) * 2 * M_PI / 5)
85+ let sine = sin(Double(i) * 2 * .pi / 5)
86+ let cosine = cos(Double(i) * 2 * .pi / 5)
8687 let radius: Double = 85
8788 let x = Double(screenWidth) / 2 + sine * radius
8889 let y = Double(screenHeight) / 2 + cosine * radius
@@ -99,8 +100,8 @@ class ViewController: UIViewController, MetaballDataSource {
99100 initialSpringVelocity: 0,
100101 options: UIViewAnimationOptions(),
101102 animations: { () -> Void in
102− let sine = sin(Double(i) * 2 * M_PI / 5)
103− let cosine = cos(Double(i) * 2 * M_PI / 5)
103+ let sine = sin(Double(i) * 2 * .pi / 5)
104+ let cosine = cos(Double(i) * 2 * .pi / 5)
104105 let radius: Double = 150
105106 let x = Double(screenWidth) / 2 + sine * radius
106107 let y = Double(screenHeight) / 2 + cosine * radius
@@ -130,7 +131,7 @@ class ViewController: UIViewController, MetaballDataSource {
130131 Timer.scheduledTimer(
131132 timeInterval: 1.0 / 60.0,
132133 target: self,
133− selector: "animateMetaballWithTimer:",
134+ selector: #selector(ViewController.animateMetaball(withTimer:)),
134135 userInfo: parameters,
135136 repeats: true)
136137 }
@@ -168,7 +169,7 @@ class ViewController: UIViewController, MetaballDataSource {
168169 Timer.scheduledTimer(
169170 timeInterval: 1.0 / 60.0,
170171 target: self,
171− selector: "animateEdgeWithTimer:",
172+ selector: #selector(ViewController.animateEdge(withTimer:)),
172173 userInfo: parameters,
173174 repeats: true)
174175 }