@@ -20,8 +20,9 @@ class ViewController: UIViewController, MetaballDataSource {
21 view.backgroundColor = UIColor.white
21 view.backgroundColor = UIColor.white
23− let recognizer = UIPanGestureRecognizer(target: self,
23+ let recognizer = UIPanGestureRecognizer(
24− action: "handlePan:")
25+ action: #selector(ViewController.handlePan(_:)))
25 view.addGestureRecognizer(recognizer)
26 view.addGestureRecognizer(recognizer)
27 var positions = [CGPoint]()
28 var positions = [CGPoint]()
@@ -29,8 +30,8 @@ class ViewController: UIViewController, MetaballDataSource {
29 x: Double(screenWidth) / 2,
30 x: Double(screenWidth) / 2,
30 y: Double(screenHeight) / 2))
31 y: Double(screenHeight) / 2))
31 for i in 1...5 {
32 for i in 1...5 {
32− let sine = sin(Double(i) * 2 * M_PI / 5)
33+ let sine = sin(Double(i) * 2 * .pi / 5)
33− let cosine = cos(Double(i) * 2 * M_PI / 5)
34+ let cosine = cos(Double(i) * 2 * .pi / 5)
34 let radius: Double = 150
35 let radius: Double = 150
35 let x = Double(screenWidth) / 2 + sine * radius
36 let x = Double(screenWidth) / 2 + sine * radius
36 let y = Double(screenHeight) / 2 + cosine * radius
37 let y = Double(screenHeight) / 2 + cosine * radius
@@ -81,8 +82,8 @@ class ViewController: UIViewController, MetaballDataSource {
81 UIView.animate(withDuration: 1.0, delay: 0,
82 UIView.animate(withDuration: 1.0, delay: 0,
82 options: UIViewAnimationOptions(),
83 options: UIViewAnimationOptions(),
83 animations: { () -> Void in
84 animations: { () -> Void in
84− let sine = sin(Double(i) * 2 * M_PI / 5)
85+ let sine = sin(Double(i) * 2 * .pi / 5)
85− let cosine = cos(Double(i) * 2 * M_PI / 5)
86+ let cosine = cos(Double(i) * 2 * .pi / 5)
86 let radius: Double = 85
87 let radius: Double = 85
87 let x = Double(screenWidth) / 2 + sine * radius
88 let x = Double(screenWidth) / 2 + sine * radius
88 let y = Double(screenHeight) / 2 + cosine * radius
89 let y = Double(screenHeight) / 2 + cosine * radius
@@ -99,8 +100,8 @@ class ViewController: UIViewController, MetaballDataSource {
99 initialSpringVelocity: 0,
100 initialSpringVelocity: 0,
100 options: UIViewAnimationOptions(),
101 options: UIViewAnimationOptions(),
101 animations: { () -> Void in
102 animations: { () -> Void in
102− let sine = sin(Double(i) * 2 * M_PI / 5)
103+ let sine = sin(Double(i) * 2 * .pi / 5)
103− let cosine = cos(Double(i) * 2 * M_PI / 5)
104+ let cosine = cos(Double(i) * 2 * .pi / 5)
104 let radius: Double = 150
105 let radius: Double = 150
105 let x = Double(screenWidth) / 2 + sine * radius
106 let x = Double(screenWidth) / 2 + sine * radius
106 let y = Double(screenHeight) / 2 + cosine * radius
107 let y = Double(screenHeight) / 2 + cosine * radius
@@ -130,7 +131,7 @@ class ViewController: UIViewController, MetaballDataSource {
130 Timer.scheduledTimer(
131 Timer.scheduledTimer(
131 timeInterval: 1.0 / 60.0,
132 timeInterval: 1.0 / 60.0,
132 target: self,
133 target: self,
133− selector: "animateMetaballWithTimer:",
134+ selector: #selector(ViewController.animateMetaball(withTimer:)),
134 userInfo: parameters,
135 userInfo: parameters,
135 repeats: true)
136 repeats: true)
@@ -168,7 +169,7 @@ class ViewController: UIViewController, MetaballDataSource {
168 Timer.scheduledTimer(
169 Timer.scheduledTimer(
169 timeInterval: 1.0 / 60.0,
170 timeInterval: 1.0 / 60.0,
170 target: self,
171 target: self,
171− selector: "animateEdgeWithTimer:",
172+ selector: #selector(ViewController.animateEdge(withTimer:)),
172 userInfo: parameters,
173 userInfo: parameters,
173 repeats: true)
174 repeats: true)