Skip to content

Commit

Permalink
add "break" to RouletteView#stop to prevent app from being crash when…
Browse files Browse the repository at this point in the history
… configure parts as soon as RouletteView stops.
  • Loading branch information
fummicc1 committed Aug 18, 2020
1 parent cac309d commit fc5e0d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Binary file not shown.
1 change: 1 addition & 0 deletions SimpleRoulette/Source/RouletteView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public class RouletteView: UIView {

if checkIfContainsPoint(from: CGFloat(start), to: CGFloat(end), point: CGFloat.pi * 1.5) {
delegate.rouletteView(self, didStopAt: part)
break
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions SimpleRouletteDemo/IB/IBRouletteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@ extension IBRouletteViewController: RouletteViewDelegate {
let alert = UIAlertController(title: "結果", message: part.name, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "閉じる", style: .default, handler: nil))
present(alert, animated: true, completion: nil)
rouletteView.configure(parts: [
Roulette.HugePart(name: "Title A", huge: .large, delegate: rouletteView, index: 0),
Roulette.HugePart(name: "Title B", huge: .small, delegate: rouletteView, index: 1),
Roulette.HugePart(name: "Title C", huge: .normal, delegate: rouletteView, index: 2),
])
}
}

0 comments on commit fc5e0d9

Please sign in to comment.