Skip to content

Commit

Permalink
Merge pull request #1 from SlaunchaMan/master
Browse files Browse the repository at this point in the history
Use associated types on the enum for image.
  • Loading branch information
sudeepag committed Mar 6, 2016
2 parents ecf5ee1 + bd6dbfb commit abe9d68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Example/SAConfettiView/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class ViewController: UIViewController {
confettiView.type = .Diamond

// For custom image
// confettiView.type = .Custom
// confettiView.customImage = UIImage(named: "diamond")
// confettiView.type = .Image(UIImage(named: "diamond")!)

// Add subview
view.addSubview(confettiView)
Expand Down
5 changes: 2 additions & 3 deletions Pod/Classes/SAConfettiView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ public class SAConfettiView: UIView {
case Triangle
case Star
case Diamond
case Custom
case Image(UIImage)
}

var emitter: CAEmitterLayer!
public var colors: [UIColor]!
public var intensity: Float!
public var type: ConfettiType!
public var customImage: UIImage?

required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
Expand Down Expand Up @@ -73,7 +72,7 @@ public class SAConfettiView: UIView {
fileName = "star"
case .Diamond:
fileName = "diamond"
case .Custom:
case let .Image(customImage):
return customImage
}

Expand Down

0 comments on commit abe9d68

Please sign in to comment.