From 6ee2eb44fc7ac121ea834ba957b7e2fd1d2e027d Mon Sep 17 00:00:00 2001 From: Jeff Kelley Date: Sun, 17 Jan 2016 22:55:04 -0500 Subject: [PATCH 1/2] Use associated types on the enum for image. --- Example/SAConfettiView/ViewController.swift | 3 +-- Pod/Classes/SAConfettiView.swift | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Example/SAConfettiView/ViewController.swift b/Example/SAConfettiView/ViewController.swift index aa595ba..7e86805 100644 --- a/Example/SAConfettiView/ViewController.swift +++ b/Example/SAConfettiView/ViewController.swift @@ -39,8 +39,7 @@ class ViewController: UIViewController { confettiView.type = .Diamond // For custom image - // confettiView.type = .Custom - // confettiView.customImage = UIImage(named: "diamond") + // confettiView.type = .Custom(UIImage(named: "diamond")!) // Add subview view.addSubview(confettiView) diff --git a/Pod/Classes/SAConfettiView.swift b/Pod/Classes/SAConfettiView.swift index b5d1cc6..e7e2eb2 100644 --- a/Pod/Classes/SAConfettiView.swift +++ b/Pod/Classes/SAConfettiView.swift @@ -16,14 +16,13 @@ public class SAConfettiView: UIView { case Triangle case Star case Diamond - case Custom + case Custom(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) @@ -73,7 +72,7 @@ public class SAConfettiView: UIView { fileName = "star" case .Diamond: fileName = "diamond" - case .Custom: + case let .Custom(customImage): return customImage } From bd6dbfb0f074804ead5e43a8332ad4c7ada71d12 Mon Sep 17 00:00:00 2001 From: Jeff Kelley Date: Mon, 25 Jan 2016 13:46:10 -0500 Subject: [PATCH 2/2] Change "Custom" to "Image." --- Example/SAConfettiView/ViewController.swift | 2 +- Pod/Classes/SAConfettiView.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Example/SAConfettiView/ViewController.swift b/Example/SAConfettiView/ViewController.swift index 7e86805..b4a9cb2 100644 --- a/Example/SAConfettiView/ViewController.swift +++ b/Example/SAConfettiView/ViewController.swift @@ -39,7 +39,7 @@ class ViewController: UIViewController { confettiView.type = .Diamond // For custom image - // confettiView.type = .Custom(UIImage(named: "diamond")!) + // confettiView.type = .Image(UIImage(named: "diamond")!) // Add subview view.addSubview(confettiView) diff --git a/Pod/Classes/SAConfettiView.swift b/Pod/Classes/SAConfettiView.swift index e7e2eb2..196b07f 100644 --- a/Pod/Classes/SAConfettiView.swift +++ b/Pod/Classes/SAConfettiView.swift @@ -16,7 +16,7 @@ public class SAConfettiView: UIView { case Triangle case Star case Diamond - case Custom(UIImage) + case Image(UIImage) } var emitter: CAEmitterLayer! @@ -72,7 +72,7 @@ public class SAConfettiView: UIView { fileName = "star" case .Diamond: fileName = "diamond" - case let .Custom(customImage): + case let .Image(customImage): return customImage }