-
Notifications
You must be signed in to change notification settings - Fork 677
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from hyperoslo/refactor
Refactor
- Loading branch information
Showing
8 changed files
with
264 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import UIKit | ||
|
||
public class ImageStack { | ||
|
||
public struct Notifications { | ||
public static let imageDidPush = "imageDidPush:" | ||
public static let imageDidDrop = "imageDidDrop:" | ||
public static let stackDidReload = "stackDidReload:" | ||
public static let imageKey = "image" | ||
} | ||
|
||
public var images = [UIImage]() | ||
|
||
public func pushImage(image: UIImage) { | ||
images.append(image) | ||
NSNotificationCenter.defaultCenter().postNotificationName(Notifications.imageDidPush, object: self, userInfo: ["image" : image]) | ||
} | ||
|
||
public func dropImage(image: UIImage) { | ||
images = images.filter() {$0 != image} | ||
NSNotificationCenter.defaultCenter().postNotificationName(Notifications.imageDidDrop, object: self, userInfo: ["image" : image]) | ||
} | ||
|
||
public func resetImages(newImages: [UIImage]) { | ||
images = newImages | ||
NSNotificationCenter.defaultCenter().postNotificationName(Notifications.stackDidReload, object: self, userInfo: nil) | ||
} | ||
|
||
public func containsImage(image: UIImage) -> Bool { | ||
return contains(images, image) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.